LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-24-2008, 10:59 AM   #1
matt007
LQ Newbie
 
Registered: Jun 2008
Posts: 14

Rep: Reputation: 0
sorting a file using bash on a certain field


sorting a fihow should i sort a file on a certain field .....i am trying this....


awk 'substr($0, 471, 10)' filename | sort >> out

i.e. pick up the 471st position and 10 characters from there and pass each line to the sort command......
10 chars at postiion 471 are :

0500010001
1500010001
0500180020
0500180020
0500180020
0500180020
0500180020
0500180020
0500180020
0500180020
0500180020
0500180020
0500010001
1500010001
 
Old 06-24-2008, 12:05 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403
Hi,

Don't crosspost.......

Possible answer is in your other thread.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting a file at a certain offset in bash matt007 Linux - Software 4 06-24-2008 04:03 PM
bash: sorting a bunch of files into two halfs by size, and other tasks PatrickMay16 General 2 01-19-2008 01:04 AM
Cant store ip address to bash field Mangled Programming 10 10-10-2007 01:32 PM
Bash: sorting by two fields humbletech99 Programming 7 09-25-2007 03:30 PM
Sorting files in BASH deleted/ Linux - Newbie 16 01-26-2006 06:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration