Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Swap columns and replace
Name: RasH Date: October 15, 2007 at 00:03:33 Pacific OS: Linux CPU/Ram: 1800/512
Comment:
Hi. I have some output that i would like filtered. Columns 2 and 3 should be interchanged and the contents of column 4 (and ONLY column 4) should be replaced: 1A6Y;173;B;F; -75.1; 167.5 1A6Y;174;B;G; 58.7; 155.7 1A6Y;175;B;R; -18.1; 142.6 1A6Y;176;B;I; -72.6; 136.1 1A6Y;177;B;P; -68.1;-136.2 1A6Y;178;B;K;-162.6; 360.0 should be 1A6Y;B;173;PHE; -75.1; 167.5 1A6Y;B;174;GLY; 58.7; 155.7 1A6Y;B;175;ARG; -18.1; 142.6 1A6Y;B;176;ILE; -72.6; 136.1 1A6Y;B;177;PRO; -68.1;-136.2 1A6Y;B;178;LYS;-162.6; 360.0
Name: RasH Date: October 15, 2007 at 09:43:39 Pacific
Reply:
Thanks for the reply. Ill get right to it. Actually i thought my example could explain what i want to replace: F => PHE G => GLY R => ARG etc..
0
Response Number 3
Name: japh Date: October 24, 2007 at 01:19:14 Pacific
Reply:
add the following to the BEGIN block: repl["F"] = "PHE"; repl["G"] = "GLY"; repl["R"] = "ARG"; repl["I"] = "ILE"; repl["P"] = "PRO"; repl["K"] = "LYS";
and add the following just before the print $0:
$4 = repl[$4];
HTH
This message was produced with 100% recycled electrons
Summary: I am working w/ this huge matrix file. Now in this matrix file 2nd column is strings. lets say its contain red, blue, black. now i can not load this file in matlab. so i wanted to change red to 1 bl...
Summary: Hi all, I have a script that scan files, find old templet and replace it with new one. #!/bin/ksh file_name=$1 old_templet=$2 new_templet=$3 # Loop through every file like this for file in file_name d...
Summary: Is it possible to do search and replace in unix Like : s/some date/current date/g some date and current date both are in same format (dd/mm/yyyy hh:mm:ss) My requirement is : I am having a variable w...