readfile - Read from text file, capture text, write to another text file in specific syntax -
i have text file following syntax:
attribute_name, 'path', 'tutorial'; attribute_name2, 'path2', 'tutorial'; ....
what need read file, capture 3 values: attribute name, path , project name (tutorial in case) , write output text file, b following syntax:
delete attribute "atribute_name" in folder "path" project "tutorial";
and repeat many iterations there lines in input file.
what best(easiest) language implement that? can provide example code that?
i'd perl, because i'm familiar perl , works great these kinds of tasks. can write sed one-liner done.
if you're not fan of perl, modern dynamic language should let job done minimal effort.
edit: example perl script (full file readability) this:
use warnings; use strict; while (my $line = <>) { $line =~ /^\s*(.+?), '(.+?)', '(.+?)';$/; # doesn't handle internal escaping print "delete attribute \"$1\" in folder \"$2\" project \"$3\";\n"; }
Comments
Post a Comment