Shell Script

Need a script for below .

896019990060000001 502195560000001 43197381 1234 1234 48694743 DFC40A06BB8A2B63A63A98E5B3ACD4BA 03300349
896019990060000002 502195560000002 07536851 1234 1234 54280393 C781699B7735B9D8B30D1B4BAE970344 56623200
896019990060000003 502195560000003 29000945 1234 1234 29681079 356EEB858937C38B4A4C9245E89D68D7 78562572



I want to print col1 , col2 col 6 sepratly to a file they are seprarted by single space.
ratna1234Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ssnkumarCommented:
cut command on Unix/Linux will do this.
Use -f and -d options to indicate the field and the delimiter (in your case this is space or ' ').
0
omarfaridCommented:
use

cut -f 1,2,6 < datafile > myfile
0
ssnkumarCommented:
@omarfarid: I could have also given the full command with all the options. The reason I didn't give the full command is, it will be like doing the homework!
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

point_pleasantCommented:
there is of course the good ole awk command

awk '{ print $1" " $2" " $6 }'  filename
0
TintinCommented:
awk '{print $1,$2,$6'} file >newfile

Open in new window

0
TintinCommented:
Typo in my last comment.

Should be:

awk '{print $1,$2,$6'} file >newfile

Open in new window

0
point_pleasantCommented:
WOW

> newfile

really?
0
TintinCommented:
point pleasant,

not sure what you mean.
0
TintinCommented:
bah, still had a typo

      

awk '{print $1,$2,$6}' file >newfile

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.