How do I use grep in a script
in Seekers of Perl Wisdom
2 direct replies — Read more / Contribute
|
by Flintlock
on Dec 26, 2017 at 12:10
|
I am trying to extract a specific portion of a line found in a file to create a file name.
I have this working for command line
grep Acct: Facs_Data.txt |cut -d":" -f2 |cut -d" " -f1
it returns the right half of the search i.e. Acct:1234 returns 1234. and I would then use this 1234 to create a file named 1234_2017.txt
So my question is: How can I achieve the same thing in Perl from opening a file that has more than one entry of Acct: ?
|