| PLEX86 | ||
|
bash script to select characters from a stringcrashing linux ray I keep log books of my machines. I have had three machines: in 1996, a 166MHz Pentium machine which started out with 32Meg RAM and Windows 95 that crashed several... hi, i have two molecular dynamics codes, both of them take the same input, but the in different format. let me explain, for one code (named PinyMD) in the input file, we have, ~atomdef-atomtyp{na}-atomind{ 1 }mbutt{14.0067}-charge{ 0.15} ~atomdef-atomtyp{na}-atomind{ 2 }mbutt{14.0067}-charge{ 0.15} ~atomdef-atomtyp{cr}-atomind{ 3 }mbutt{12.0107}-charge{-0.11} ~atomdef-atomtyp{cw}-atomind{ 4 }mbutt{12.0107}-charge{-0.13} ~atomdef-atomtyp{cw}-atomind{ 5 }mbutt{12.0107}-charge{-0.13} and so on........ and for other code (named NMA) the input file, 1 1 2 1 3 2 4 1 5 1 6 2 7 1 8 1 and so on.... the relation between them is very straightforwd. what appears in PinyMD's input file as "na" might be an integer 1 or "cr" be integer 2 for NMA. i am trying to write a bash script, which will read in PinyMD input file and convert in the NMA file, after reading the line, ~atomdef-atomtyp{na}-atomind{ 1 }mbutt{14.0067}-charge{ 0.15} ~atomdef-atomtyp{cr}-atomind{ 2 }mbutt{14.0067}-charge{ 0.15} so on..... it should echo, 1 1 2 3 so on.... how do i pick up elements 'na' (which i will replace with some integer) and atomind{ 1 } which i will replace with 1? $ cat PinyMD ~atomdef-atomtyp{na}-atomind{ 1 }mbutt{14.0067}-charge{ 0.15} ~atomdef-atomtyp{na}-atomind{ 2 }mbutt{14.0067}-charge{ 0.15} ~atomdef-atomtyp{cr}-atomind{ 3 }mbutt{12.0107}-charge{-0.11} ~atomdef-atomtyp{cw}-atomind{ 4 }mbutt{12.0107}-charge{-0.13} ~atomdef-atomtyp{cw}-atomind{ 5 }mbutt{12.0107}-charge{-0.13} Linux Users Helping New Orleans Bongo Party On 3 Sep 2005 16:01:18 -0700, "Bongo Bopper (Spook Exterminator)" Near enough. All of humanity is defective, that's why we have introduced... $ awk -F '{} +' '{print $4 " " $2}' PinyMD sed -e 's-na-1-' -e 's-cr-2-' -e 's-cw-3-' 1 1 2 1 3 2 4 3 5 3 Machine Name and Privacy Jack Ouzzi on Sunday 04 September 2005 11:01 Firewall and security in this particular context are different. Whenever... Change the values in the sed subsbreastute commands as appropriate. -- Asking for technical help in newsgroups? Read this first:
|
||||
Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||