Search Results

Search: Posts Made By: saw7
1,668
Posted By methyl
@Scrutinizer . With just "sort" the hyphens...
@Scrutinizer . With just "sort" the hyphens throw the order.

Using a bit more data to make the problem more visible.

Original file:

MARTINEZ---PAUL
--DUPOND---EDDY
--DURANDJACQUES...
1,668
Posted By zaxxon
I am totally unsure now lol. I had sorted it...
I am totally unsure now lol. I had sorted it without any parameter too and saw output was sorted as OP wanted it, as you stated it. Anyway I was not sure if there could be a constellation where the...
1,668
Posted By Scrutinizer
Hi Zaxxon, I was looking at the question but...
Hi Zaxxon, I was looking at the question but could not understand the reason. Wouldn't this be equivalent to plain:
sort infile
1,668
Posted By methyl
No need to separate the keys. Sort to...
No need to separate the keys. Sort to "dictionary" order.

sort -d filename

--DUPOND--ALAIN
--DUPOND---EDDY
--DURANDJACQUES
MARTINEZ---PAUL
1,668
Posted By zaxxon
Yes - I deleted my answer since it was somewhat...
Yes - I deleted my answer since it was somewhat awkward and I come back with a better solution if not already someone else did ;)
1,780
Posted By Scott
$ awk -F\* 'BEGIN {OFS = FS} NR == FNR { A[$0]=1;...
$ awk -F\* 'BEGIN {OFS = FS} NR == FNR { A[$0]=1; next } A[$4] { X=$4; $4=$3; $3=X }1 ' 1.tmp 2.tmp
1*TEST1*111**LA
2*TEST2**112*LA
3*TEST3*222**LA
4*TEST4**333*LA
5*TEST5*555**LA


Use nawk...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 07:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy