Multi-character tab problem in sort

2009-08-19 Thread Michael Muratet

Greetings

I found a definition in the make file:

# The quote marks below contain a tab character
SORT_BY_TAB:=sort -T . --field-separator="  "

which means it's back to a tab problem which I think I can sort out  
from the archives.


Thanks

Mike





Multi-character field separators in sort

2009-08-19 Thread Michael Muratet

Greetings

I'm sure this question has come up, but I cannot find the answer in  
the archives. I have a make file generated by a third-party python  
script with the following line that I am trying to run in bash on  
CentOS 5.2:


set -o pipefail;  cat s_1_1_export.txt | \
awk -F$'\t' '$13 != "" && $NF == "Y" {OFS="\t"; --NF; $13 =  
sprintf("%011d", $13+1); print $0}' | \

sort -T . --field-separator="  " --buffer-size=500M -k11,13 | \
awk -F$'\t' '{OFS="\t"; $13 = $13-1; print $0}'  >  
s_1_1_sorted.txt.tmp && mv s_1_1_sorted.txt.tmp s_1_1_sorted.txt


I am having two problems with the sort command. The first is that it  
reports sort: cannot create temporary file: ./sortdKFMLK: Permission  
denied. The directory permissions are wide open. I solved that by  
increasing the buffer to 1000M. The second problem persists. The 3- 
space field separator is generating an error, sort: multi-character  
tab '   ". I've found a lot of discussion about how various shells  
treat escaped characters, but I'm looking for a definitive statement  
that sort can handle separators with more than one character (or not).


I have v5.97 of the coreutils and b3.2.25(1) of bash.

Thanks

Mike