sed to edit (not just print) lines of 65 characters -


it's easy find instructions on how print lines 65 characters or more (google "sed one-liners), can't figure out syntax edit line (i.e., substitution) on such line.

to make changes on lines has 65 or above characters.

sed '/^.\{65,\}/s/.*/llll/' file 

this replace characters on lines has 65 or above characters llll. substitution works on lines only.

^.\{65,\} search pattern matches lines satisfies given condition. \{65,\} called repetition quantifier repeats previous token (that .) 65 or more times. save changes made, need add inline edit -i parameter sed command.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -