0
I am new at Bash. I have a directory tags
with a lot of .txt
files with similar names like this
[coral/home/tags]$ ls:
file1.txt file2.txt file3.txt file4.txt
Each .txt
file contains information like this:
line1 b1
line2 b2
line3 b3
line4 b4
I want to look in every text file and find those with the word b3
. If the file contains that word I want the script to write the entire line and the text file that contains such word.
This is my failed attempt:
#!/usr/bin/env
PATH=path/to/files
for x in $PATH:
do
echo $x
done
you want the output to be
line3 b3 filename.txt
? – meatspace – 2015-04-27T02:22:53.377yes, the line with b3 and the name of those files that contains it – karla – 2015-04-27T02:24:12.373