I am using echo and sed to print a string between two strings, but it is giving me error "no such file of directory"
$SEARCH_1=12
$FO_FILE=myfile.txt
SEARCH=$(head -$SEARCH_1 $FO_FILE | tail -1 | grep BShare)
LOC=echo $SEARCH_2 | sed 's/\(.*\)BShare>\(.*\)<\/BShare\(.*\)/\2/g'
If I don't use LOC= and use only echo it prints the string correctly. example
<test>mystring</test> will be printed as mystring
but if I assign the echo command to a variable it says "no such file or directory"
search_1=12; fo_file=myfile.txt. I strongly recommend you don't use ALL_CAPS_VARNAMES, save those for the shell's use -- one day you'll writePATH=5and wonder why your script is broken. - glenn jackmanSEARCH(where you use$(...)) and toLOC(where you do not)? - chepner