469,275 Members | 1,802 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

using perl on the command line, like sed or awk

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
2 7179
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
> 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.

Similar topics

4 posts views Thread by Mark Wilson CPU | last post: by
52 posts views Thread by Olivier Scalbert | last post: by
2 posts views Thread by James Hull | last post: by
reply views Thread by Danny Jensen | last post: by
10 posts views Thread by Hendry Taylor | last post: by
121 posts views Thread by typingcat | last post: by
4 posts views Thread by Ignoramus6539 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.