Reading a variable line by line with while loop
Smoot Carl-Mitchell
smoot at tic.com
Tue Dec 1 16:32:58 UTC 2009
On Tue, 2009-12-01 at 07:39 -0800, 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?
Check out the sort and uniq command. You need sort for uniq to work
correctly when deduping lines in a file. The original order is not
preserved. The simple idiom for deduping stdin and writing it to stdout
is:
sort | uniq
>
> I don't mean to get you to do my programming for me, and I will begin
> studying the sed manual right after I send this to see if I can figure
> it out myself. I just thought I'd pick your brain a bit more. 8-)
Happy to help. sed is extremely useful and it is always a good idea to
learn regular expression which sed uses. They are quite powerful.
--
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005
More information about the ubuntu-users
mailing list