I have a filename variable that sometimes gets set as:
attachment;
JobRunStatisticsReport_20150122.zip
In the File Manager window, it looks like this:
I need help coming up with an IF statement that says:
IF $filename contains 'attachment; \n' then
and then help with a SED that looks for that new line character (\n) and replaces that and everything before it with nothing.
Can anyone lend a quick hand please?
sed
specifically? it doesn't naturally deal with multi-line input, and if you already have the name in a shell variable why not try something bash-based like"${var#*$'\n'}"
?sed 's/.*\\n//g'
andsed 's/.*\\r//g'
?for k in $(ls "$dec")
as it will word split - usefor k in "$dec"/*
instead, and remember to also quote k when you use it"$k"
.