Forum Moderators: bakedjake
I want to know how I can use shell script to process a text file containing data of the format below:
Justin=Idiot Britney=Hot chick
To the format:
define ("Justin", "Idiot"); define ("Britney", "Hot chick");
Thanks in advance!
cat myfile ¦ perl -p -e 's/(.*)=(.*)/define (\"$1\", \"$2\");/'
Not exactly wizardry, though ;)
Sean
I tried: cat stupidjustin.txt ¦ perl -p -e 's/(.*)=(.*)/define (\"$1\", \"$2\");/'
But I got cat: invalid option -- p Dya have a clue whats wrong?
cat stupidjustin.txt ¦ perl -ne 's/(.*)\=(.*)/qq~define \("$1", "$2"\)/;print'