Having trouble with grepping and cutting at the same time
I have a file test.txt
.
Inside the file is this syntax
File: blah.txt Location: /home/john/Documents/play/blah.txt
File: testing.txt Location /home/john
My command is ./delete -r (filename)
, say filename is blah.txt
.
How would i search test.txt
for blah.txt
and cut the /home/john/Documents/play/blah.txt
out and put it in a variable
grep -P "^File: blah\.txt Location: .+" test.txt | cut -d: -f3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With