I need to remove whitespace from the name that is in between the quotes. What I am currently doing is the following:Tag { Description "blah blah blah" ... Name "test tag" ... }
There has to be a better way to do this..$^I = ".bak"; @ARGV = "test.txt"; while(<>) { if(/^\s+Tag {/) { print; #skip over lines before 'Name' line while(<>) { if(/^\s+Name/) { s/"(.*)\s+(.*)/"$1$2"/g; print; last; } else { print; } } else { print; } }
In reply to In-place editing of files by richz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |