Im working in a perl one liner to invert the contents of my file contents or perform operations, I was able to generate the script and one liner, but this one liner only works by entering file by file.
perl -i -ne '$a=reverse $_;print "$a\n"' <filename>
I want to change my one liner to get input from a range of files but when i do:
perl -i -ne '$a=reverse $_;print "$a\n"' | ls -al
I just get screen output of ls -al
Not sure how to proceed.
Thanks
你可以使用xargs(1):
ls | xargs perl -i -ne '$a=reverse $_;print "$a\n"'
perl -nle '$c=reverse;print $c' * .*
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.