in reply to Appending string to all lines
Ideally, you should be using a well-tested module like Text::CSV for these kind of activities. Since this is an one-time activity, I'm going to show you the simplest way. Why not do something like:
$ cat > somestuff.csv 10004,Able,Baker,able.baker@notrealemail.com 14634,Charley,Delta,charley.delta@notrealemail.com 12886,Echo,Foxtrot,echo.foxtrot@notrealemail.com 14366,Golf,Hotel,golf.hotel@notrealemail.com 10178,India,Juliet,india.juliet@notrealemail.com 10164,Kilo,Lima,kilo.lima@notrealemail.com 10124,Mike,November,mike.november@notrealemail.com $ perl -pi -e 's/\Z/,UF,A,Y,9,U/' somestuff.csv $ cat somestuff.csv 10004,Able,Baker,able.baker@notrealemail.com,UF,A,Y,9,U 14634,Charley,Delta,charley.delta@notrealemail.com,UF,A,Y,9,U 12886,Echo,Foxtrot,echo.foxtrot@notrealemail.com,UF,A,Y,9,U 14366,Golf,Hotel,golf.hotel@notrealemail.com,UF,A,Y,9,U 10178,India,Juliet,india.juliet@notrealemail.com,UF,A,Y,9,U 10164,Kilo,Lima,kilo.lima@notrealemail.com,UF,A,Y,9,U 10124,Mike,November,mike.november@notrealemail.com,UF,A,Y,9,U $
Doing things like calling perl to do AWK is just overkill, since perl was meant to take in all the goodness of sed, awk and shell scripting, wiping away the pain of all other scripting stuff!
Do read more of perl "pie-ness" in perlrun and CSV handling in Text::CSV. Have fun!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Appending string to all lines
by bentrim (Initiate) on Nov 11, 2016 at 15:51 UTC | |
by Laurent_R (Canon) on Nov 11, 2016 at 16:22 UTC |