I am trying to get an if statement to work in bash that deals with lines beginning with \
in a text file.
Something like this:
shasum -a 256 file_A\\\\\/\/.txt >> file_B.txt
if line begins with '\' in file_B.txt
then awk '{ print "^.65 ", $0, "$" }' that line in file_C.txt
else
if line not begin with '\' in file_B.txt
then awk '{ print "^.64 ", $0, "$" }' that line in file_C.txt
fi
fi
Contents of file_B.txt:
e5fba57b49dbe8196ee4fb4ddb407885582f88d8e52dfa6e5adb55204b589a88 /Users/1337/file_D.txt
\66590f18dafff57160770d885b090d54455e0fc900342d7752dc420405ae50f5 /Users/1337/file_A\\::.txt
Contents of file_C.txt:
/Users/1337/file_D.txt
/Users/1337/file_A\\::.txt
So, basically, the end result would look like this (this is inside file_C.txt):
^.64 /Users/1337/file_D.txt$
^.65 /Users/1337/file_A\\::.txt$
because line 2 began with a \
and line 1 didn't.
If any of this is confusing, please don't hesitate asking me to clarify.
Mac OS X Yosemite, bash 3.2.57(1)-release
Aucun commentaire:
Enregistrer un commentaire