I am very new to shell scripting I had a small query regarding the file parsing.
So, here's what I am trying to do:
I run an svn merge command, and genaratea conflict file
my conflict file is stored as conflicts.txt
What I want to do is read this file line by line and parse one line to match against some keywords.
For example one of the line in files look like this:
C Client/Game/src/test/test.php
Now I want to parse this line and search for the keyword test
, in case I find it I want to do some action on it, for example aborting with exit status 2, 3, etc..
for example i want to iterate throught a text file called "FILENAME" which looks like this
30 '!' C Client/test.js
31 '!' C Client/test2.js
32 '!' C Client/test3.js
`
what i am doing is catting the file using the while loop and cat commnad
cat $FILENAME | while read LINE
do
echo $LINE
done
here i am just printing the line , i want to know how can i search for a keyworkd in the line and if i find that keyword how can i do some action on it like exiting with status 1
Can you please suggest some way to do this..