User since: Dec 26, 2017 at 12:27 UTC (8 years ago)
Last here: Dec 29, 2017 at 20:17 UTC (8 years ago)
Experience: 45
Level:Novice (2)
Writeups: 13
Location:Oklahoma
User's localtime: Dec 17, 2025 at 21:01 UTC
Scratchpad: View
For this user:Search nodes

New to perl


Posts by Flintlock
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: ?