as mentioned in title. I found a command that works so lines that are doubled are removed:
perl -i.bak -ne 'print if ! $x{$_}++' ~/.bashrc
but how to achieve that only after line that contains specific string, sth like:
if line is after line with string "hello"
perl -i.bak -ne 'print if ! $x{$_}++' ~/.bashrc
I am trying to use bash for it.
You can use the range extraction operator ..
:
perl -i.bak -ne 'print if //../hello/ or !$x{$_}++' ~/.bashrc