Skip to main content
7 events
when toggle format what by license comment
Jun 3, 2016 at 12:03 comment added Tarun JaiRaj Narwani Thanks everyone for the response. As pointed out in the comments by +Stephen Harris, the problem was with the single quoting 's///g'. With double quotes it works perfectly fine. If I try the awk + sed it takes longer than the doing while directly on the file and sed -i.
Jun 3, 2016 at 10:45 comment added Rob The real question is does it work? :) There is always ten different ways to do something. awk is neither better or worse than sed. They are tools to get something done. Can you do it is awk in two easy to read lines?
Jun 3, 2016 at 7:42 comment added Michael Vehrs So, you use the powerful awk to generate an input file for the less powerful sed, instead of using awk directly?
Jun 2, 2016 at 23:36 comment added Wildcard Nice, but if this is scripted you shouldn't use a fixed temp file name. Since the Original Poster specified bash, I'd opt for process substitution instead: sed -i -f <(awk '{print "s/sp_"$1"/"$2"/g"}' File2.txt) File1.txt
Jun 2, 2016 at 17:03 history edited Rob CC BY-SA 3.0
added 3 characters in body
Jun 2, 2016 at 16:56 history edited Rob CC BY-SA 3.0
added 50 characters in body
Jun 2, 2016 at 16:48 history answered Rob CC BY-SA 3.0