Hi thanks again,
the file will be something like as the text will be surrounded by quotes;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,"1-this is a test",20
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,"2-this is a test",21
...
when I run
cat file.tmp | perl -pe 's/(([^,]*,){18}\w+)/$1,/'
it doesn't like the double quotes, I would want it to produce
something like
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,"1-","this is a test",20
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,"2"-"this is a test",21
...
---------- Post updated at 09:58 AM ---------- Previous update was at 08:56 AM ----------
Hopefully final question,
How do I call this from within a script so that it writes into a secondary file
e.g.,
my $tmpfile2=/tmp/tmpfile2.tmp;
cat /tmp/file.tmp | perl -pe 's/(([^,]*,){18}\w+)/$1,/' >> $tmpfile2