Reading a variable line by line with while loop

Avi Greenbury avismailinglistaccount at googlemail.com
Tue Dec 1 15:49:46 UTC 2009


Ray Parrish wrote:

> Smoot Carl-Mitchell wrote:
> Thank you! That worked great! Now I wonder is there is another great
> sed command that will remove redundancy in the bash history, so no
> command line is repeated in the final results in the $History
> variable?

man uniq

which requires you to sort it, too:

man sort

since it checks for repeated (consecutive) lines. If order matters,
you'll need something more complicated. 

sed can probably be made to do it, but piping through sort and uniq is
probably nicer.


--
Avi Greenbury
http://aviswebsite.co.uk ;)
http://aviswebsite.co.uk/asking-questions




More information about the ubuntu-users mailing list