Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to clean this up 1

Status
Not open for further replies.

Kipnep70

Technical User
Nov 18, 2003
81
US
Can somebody clean my command line up a little bit.

The text I want to maniuplate comes from an output of a command:

Code:
Master;HP-UX-IA64, HP-UX11.23;6.5.3;NetBackup;6.5;650000;/usr/openv/netbackup/bin;HP-UX B.11.23 ;

6.5.3.1

I'm trying to get it all on one line. I want to keep the ";" as the field delimiter.

like this:

Code:
Master;HP-UX-IA64, HP-UX11.23;6.5.3;NetBackup;6.5;650000;/usr/openv/netbackup/bin;HP-UX B.11.23;6.5.3.1

I also don't want any extra spaces between fields.

Here is what I'm running:

Code:
./someCommand | sed '/^$/d' | awk -F";" 'BEGIN{ORS=";"}1' | awk -F";" '{print $2 ";" $10}'

If somebody can help me figure out how to shorten this, I'd appreciate it.
 

Try this:
Code:
echo "`./someCommand`"|tr -d "\n"|-cut -d';' -f1,8
[3eyes]
PS: You only have 8 fields.


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thank you, for whatever reason the last suggestion worked the best. The first two produced an empty line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top