Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Shell Script

Posted on 2011-02-24
9
Medium Priority
?
228 Views
Last Modified: 2012-08-14
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.
0
Comment
Question by:ratna1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 8

Expert Comment

by:ssnkumar
ID: 34968140
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 34969172
use

cut -f 1,2,6 < datafile > myfile
0
 
LVL 8

Expert Comment

by:ssnkumar
ID: 34969491
@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.

 
LVL 8

Expert Comment

by:point_pleasant
ID: 34970635
there is of course the good ole awk command

awk '{ print $1" " $2" " $6 }'  filename
0
 
LVL 48

Expert Comment

by:Tintin
ID: 34975693
awk '{print $1,$2,$6'} file >newfile

Open in new window

0
 
LVL 48

Expert Comment

by:Tintin
ID: 34975700
Typo in my last comment.

Should be:

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

Open in new window

0
 
LVL 8

Expert Comment

by:point_pleasant
ID: 34976214
WOW

> newfile

really?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 34977793
point pleasant,

not sure what you mean.
0
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 34977795
bah, still had a typo

      

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

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question