Computing.Net > Forums > Unix > Sorting a string/ file

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Sorting a string/ file

Reply to Message Icon

Original Message
Name: Anomander Rake
Date: January 12, 2006 at 07:30:29 Pacific
Subject: Sorting a string/ file
OS: HP-UX
CPU/Ram: 10
Comment:

Hello all, I have a file with entries in the format
*****
01234ABCDEFGHIJKLMN 5 67.89
*****
I would like to extract the data in this format:

****
3 ABCDE 5 6
****

I can use "cut" to extract the data, but it won't have the recommended white spaces. Can anyone help?

Thanks
Anomander


Report Offensive Message For Removal


Response Number 1
Name: vicchai
Date: January 13, 2006 at 06:40:42 Pacific
Reply: (edit)

Maybe you need to break it:
first=`cut -c 4`
next=`cut -c 6-10,20-23`
echo "$first $next"


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge
Poll History




Data Recovery Software