Can you come up with a canonicalization for all these fields? Even if you can't keep them in canonical form, that would basically solve the immediate problem.
Let's say, for example, always sort them so $1 is alphabetically before $3. So swap any fields where $3 is before $1, then sort -u and all that.
Extending this to keep counts for each canonical form in awk itself should be fairly trivial.
Addendum: If you have additional fields you need to key on just $1$2$3 instead of $0, of course. Then you can't keep them in the weighted summary, though.
Last edited by era; 04-07-2008 at 04:37 PM..
Reason: Added the second script
Hi,
I have a file that looks something like this:
...
0,6,256,87,0,0,0,1187443420
0,6,438,37,0,0,0,1187443380
0,2,0,0,0,10,0,1197140320
0,3,0,0,0,10,0,1197140875
0,2,0,0,0,23,0,1197140332
0,3,0,0,0,23,0,1197140437
0,2,0,0,0,17,0,1197140447
0,3,0,0,0,17,0,1197140543... (8 Replies)
hi,
i want to create a script that will search and replace the values inside a particular file. i have 5 files that i need to change some values inside and i don't want to use vi to edit these files. All the inputted values on the script below will be passed into the files.
cho ""
echo... (3 Replies)
I am using perl to perform a search and replace. It works at the command line, but not in the csh shell script
perl -pi -e 's@/Pattern@@g' $path/$file
I used the @ as my delimiter because the pattern contains "/" (3 Replies)
Hi,
I am trying to write a shell script designed to take input line by line by line from a file with a word on each line for editing with sed. Example file:
1.ejverything
2.bllown
3.maikling
4.manegement
5.existjing
6.systems
My design currently takes input from the user, and... (2 Replies)
I have a text file for which i need a script which does some fancy search and replace.
Basically i want to loop through each line, if i find an occurance of certain string format then i want to carry on search on replace another line, once i replaced this line i will contine to search for the... (7 Replies)
Please Help to Check script Search and Replace
Ex. Search 0001 and Replete un_0001
---script
Code:
nawk -F\" 'NR==FNR{a;next}$2 in a{sub($2,"un_"$2)}1' input.txt file*.txt > resoult.txt
script is work to one result but
if i have file1.txt, file2.txt, file3.txt i want to Replace... (5 Replies)
Ok,
what about:
array set simulation_frames { ... }
foreach { frames } {
writepdb pdb_$frames.pdb
}Now, my question is simply, what strategy could I use to import my numbers into the array { ... }
I could manually copy them, and that would work, but is there another way? (2 Replies)
Hi All,
I am trying to write a script which will find a particular text in certain group of files under a directory and if found correctly it will replace them with a new text in all the files.
Could any one let me know how do i find the text in many files under a directory.
Thanks (3 Replies)
Hi,
Below is the script which will find a particular text and replace with another one in a group of files under a directory /test
#!/bin/bash
old=$1 --- first input old text
new=$2--- input new text
cd /test --- folder into which files need to be checked
for y in `ls *`;
do sed... (2 Replies)
Hi,
I have an input file with below data and rules file to apply search and replace by each field in the input based on exact value or pattern.
Could you please help me with unix script to read input file and rules file and then create the output and reject files based on the rules file.
Input... (13 Replies)