By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

using perl on the command line, like sed or awk

P: n/a
Hello,

Using sed or awk, I can quickly parse and perform operations on the
command line itself as in:

cat file | sed 's/cat/dog'
cat file | awk ' /cat/ {print "found the cat"} '

How can i do something like the above in perl on the command line
without having to write a script in a seperate file?

Thanks
-s
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
sm*******@excite.com (gorda) wrote in
news:87*************************@posting.google.co m:
Hello,

Using sed or awk, I can quickly parse and perform operations on the
command line itself as in:

cat file | sed 's/cat/dog'
cat file | awk ' /cat/ {print "found the cat"} '

How can i do something like the above in perl on the command line
without having to write a script in a seperate file?


perl -pe 's/cat/dog/' file

See 'perldoc perlrun'

--
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
Jul 19 '05 #2

P: n/a
> How can i do something like the above in perl on the command line
without having to write a script in a seperate file?

$ perl -e 'print 123;'

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.