I'm doing this using awk and getting correct results:
$ dirs -v | awk 'BEGIN { OFS=":"; ORS=" "; } ; { print $1,$2 }'
0:/home 1:/etc 2:~
I'm trying to do this using Perl (as gnu awk not available on target
system), and getting stuck:
$ dirs -v | perl -wnla -e 'BEGIN {$\=' '; } ; ($A,$B)[EMAIL PROTECTED]; print
"$A:$B";
'
syntax error at -e line 1, at EOF
BEGIN not safe after errors--compilation aborted at -e line 1.
ie I'm trying to set the OFS (output field separator $\). Any ideas what
I'm doing wrong? And how do I set the ORS (output record separator) in
Perl (rather than doing print "$A:$B")?
Thanks perl mongers :-)
(Yes, I'm trying to munge my prompt to show the contents of dirs -v from
pushd/popd. I'll put in a "$. < 5 and blah " so it doesn't get too
long...)
--
Sonia Hamilton
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html