Link to home
Start Free TrialLog in
Avatar of NewtonianB
NewtonianB

asked on

grep piping

#myScript.sh
cat cars.txt | egrep 'car1|car2'
   outputs: car1: 1a
                 car2: 1b
                 car1: 2d
                 car2: 2e

What I would like to accomplish is have an output like below using the minimal commands
1a with 1b
2d with 2e

Can I modify egrep output to match my format and do this all at once? Would you pipe to echo?

Before I do any manual processing I wanted to ensure there were no elegant unix ways of accomplishing this..


ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NewtonianB
NewtonianB

ASKER

thanks!