AWK adding prefix/suffix to list of strings

75
103
131
133
138
183
197
221
232
234
248
256
286
342
368
389
463
499
524
538
556
564

For this list of strings I would like to add a preifx, pdb_, and a suffix .namd
How might one do this for all records?

 
awk '{print "pdb_"$0".namd"}' input.txt
1 Like

I would like to do these three printing commands at once, why am I getting an error?

awk '{print 'scp -r pdb_00.namd pdb_"$0".namd'; print 'sed 's/'pdb_00'/'pdb_"$0"'/g' pdb_"$0".namd > tempo'; print 'mv tempo pdb_"$0".namd'}' datA.dat > copy_script.bash

can you tell, what exactly you want to do ?

scp all the files ?

Ok, let's forget the last question, instead:

awk '{print "sed 's/pdb_00/'pdb_"$0"'/g' pdb_"$0".namd > tempo"}' 

is there a way to preserve the sed 's///g' tick marks '
cause they disappear with the awk command?

try with

 
\'