Presort Data Files

Moderator: NorbertKrupa

Post Reply
hopewell
Beginner
Beginner
Posts: 29
Joined: Wed Mar 27, 2013 10:39 pm

Presort Data Files

Post by hopewell » Thu Apr 25, 2013 1:40 pm

Hi,

I think it may be faster to load data files if I presort them. I'm having trouble getting the sort command to work. Specifically when trying to use a pipe field delimiter...

For example, I want to sort the data file test.txt by the second column:

Code: Select all

bash-3.2$ cat test.txt
G|1
H|50
K|22
I|2
B|300
Z|4
P|200
bash-3.2$ sort -t| +1 -1 test.txt > test1.txt
bash: +1: command not found
sort: option requires an argument -- t
Try `sort --help' for more information.
bash-3.2$
How do I tell the sort command I am using the pipe delimiter?

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1823
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: Presort Data Files

Post by JimKnicely » Thu Apr 25, 2013 1:44 pm

Try this:
  • sort --field-separator="|" -k2 -n test.txt > test1.txt
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

Post Reply

Return to “Vertica and the Operating System”