I want to get a list of lines in a batch file which are greater than 120 characters length. For this I thought of using sed. I tried but I was not successful. How can i achieve this ? Is there any other way to get a list other than using sed ?? Thanks..
The -n option will prevent to print anything unless an explicit request to print is found ( ^. {101,149}$ "Lines longer than 100(>=101) and smaller than 150 characters(<=149)"). The /p flag used as one way to turn printing back on. The -r enables the Extended regular expressions.
Another way to do this using awk:
cat file | awk 'length($0) > 120'
You can use grep
and its repetition quantifier:
grep '.\{120\}' script.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With