perl one-liner 像grep? [英] perl one-liner like grep?

查看:16
本文介绍了perl one-liner 像grep?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让 perl 做一个像 grep

i'd like perl to do a one-liner like grep

有点像这样,但我不知道要添加什么才能使它起作用

a bit like this, but i'm not sure what to add to make it work

$ (echo a ; echo b ; echo c) | perl -e 'a'

添加我在这里的回答涵盖了这一点以及更多
https://superuser.com/questions/416419/perl-for-matching-with-regex-in-terminal

ADDED My answer here covers that and more
https://superuser.com/questions/416419/perl-for-matching-with-regex-in-terminal

推荐答案

(echo a; echo b; echo c) | perl -ne 'print if /a/'

这篇关于perl one-liner 像grep?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆