linux - Bash script to Edit all -
linux - Bash script to Edit all -
i haven't been able find i'm looking for, figured i'd ask. i'm looking way following:
scan directory containing numbered directories (25-109) scan directories within of numbered directories find line in files named "map.inp" containing text: "map_93= 93 a" change occurrences "map_93= 93 v"normally manually, there 1 one thousand files edit each within own directory. found linux scheme accomplish this, i'm not sure how utilize bash script has same functionality. files modified have same name, map.inp.
the pathways within directory jan10, in subdirectories this:
/user/jan10/100/100a/map.inp /user/jan10/99/99a/map.inp
etc.
the linux scheme found work this:
find /user/jan10/ \ name map.inp \ exec sed -i~ 's/map_93= 93 a\+/map_93= 93 v/' {} \;
the desired input be:
map_89= 93
and output:
map_93= 93 v
does have thought on how this? apologize if unclear,
you forget add together -
before name
, exec
parameters in above mentioned find
command.
find /user/jan10/ -name "map.inp" -exec sed -i 's/map_89= 93 a\+/map_93= 93 v/' {} \;
linux bash sed
Comments
Post a Comment