combining cat output and cutting rows

I have a file that contain the following.

-D HTTPD_ROOT="/usr/local/apache"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

I want a shell script, so that after cat filename and apply the shell script I should get the output as follows.

/usr/local/apache/conf/httpd.conf

ie
cat filename | <shell_script>

 sed -e 's/[-[A-Z_*=]//g;s/"//g'  test.txt |sed 'N;s/\n /\//'
/usr/local/apache/conf/httpd.conf

Thanks
Sha

awk -F"\"" '{printf $2;getline;print "/"$2}' filename
1 Like

Alternate sed..

 
sed 's/^.*=//;N;s/\n.*=/\//;s/"//g' inputfile > outfile

Thank you very much. It worked. Now if I get this also correct, it s huge relieve,

File content

"now"you"
"can"dance"

Result should be

now you can dance
awk -F"\"" '{printf $2" "$3;getline;print " $2" "$3}' filename

I also got it . Thanks :slight_smile:

sed -e 's/"//g' |  awk '{printf $1" "$2;getline;print " "$1" "$2}'
head -2 infile.txt |awk -F "=" '{print $2}' | tr -d \" | tr '\n' '/'