troubleshooting Question

Pull out unique records from text file based on the second field

Avatar of Richard Kreidl
Richard KreidlFlag for United States of America asked on
Perl
5 Comments1 Solution226 ViewsLast Modified:
I have the following text file that I want to parse out the records based on the second field. I need to list out a record only once when the second field changes.
The file is delimited between the first and second and third field by a space. The second field is a number which ascends.  The output should look like this


tnetworkMsfDataFtp 30 NEW BUSINESS SERVICES ACTUARIAL STUDY DATA NBS/ACST OTHER, DETAIL CODE NEEDED
mfdstBreakageSuspBalFileW 112 ACCOUNTING SERVICES MFA  BREAKAGE OTHER DETAIL CODE NEEDED
reequityGetBankWire 203 INSTITUTIONAL INVESTMENT SERVICES RE EQUITY-PSE1 OTHER, DETAIL CODE NEEDED
reequityPutBankWire 203 INSTITUTIONAL INVESTMENT SERVICES RE EQUITY-PSE1 OTHER, DETAIL CODE NEEDED
udbJSGenerate 224 DATABASE DB2 UDB FOR UNIX OTHER, DETAIL CODE NEEDED
udbAuditDirRun 224 DATABASE DB2 UDB FOR UNIX OTHER, DETAIL CODE NEEDED
stormgmtudbOnlineIpsamddpBkp 224 DATABASE DB2 UDB FOR UNIX OTHER, DETAIL CODE NEEDED
cdmSpecProdNT 252 HOSTING - DISTRIBUTED APFILER OTHER, DETAIL CODE NEEDED
fieldrptFadmPbrNRFGA7 252 HOSTING - DISTRIBUTED APFILER OTHER, DETAIL CODE NEEDED
fieldrptFadmPbrNRFGA7Box 252 HOSTING - DISTRIBUTED APFILER OTHER, DETAIL CODE NEEDED
mfdstBCPProcessBox 255 ACCOUNTING SERVICES MFA UNIX OTHER DETAIL CODE NEEDED
mfdstBCPCopySourceToJinn 255 ACCOUNTING SERVICES MFA UNIX OTHER DETAIL CODE NEEDED
mfdstBCPCopyScriptsToJinn 255 ACCOUNTING SERVICES MFA UNIX OTHER DETAIL CODE NEEDED
dailyopsTest123 276 HOSTING - DISTRIBUTED HP OPEN VIEW OTHER, DETAIL CODE NEEDED
pacCreateMailNT 291 SYSTEMS MANAGEMENT LOTS OTHER, DETAIL CODE NEEDED
pacStopCreateMailNT 291 SYSTEMS MANAGEMENT LOTS OTHER, DETAIL CODE NEEDED
dailyopsJobfail2 306 HOSTING - MAINFRAME DFSORT OTHER, DETAIL CODE NEEDED
psledgerUVTW 347 ACCOUNTING SERVICES PEOPLESOFT GENERAL LEDGER OTHER DETAIL CODE NEEDED
psledgerCheck 347 ACCOUNTING SERVICES PEOPLESOFT GENERAL LEDGER OTHER DETAIL CODE NEEDED
psledgerUVTBx 347 ACCOUNTING SERVICES PEOPLESOFT GENERAL LEDGER OTHER DETAIL CODE NEEDED


The output should look like this:

tnetworkMsfDataFtp 30 NEW BUSINESS SERVICES ACTUARIAL STUDY DATA NBS/ACST OTHER, DETAIL CODE NEEDED
mfdstBreakageSuspBalFileW 112 ACCOUNTING SERVICES MFA  BREAKAGE OTHER DETAIL CODE NEEDED
reequityGetBankWire 203 INSTITUTIONAL INVESTMENT SERVICES RE EQUITY-PSE1 OTHER, DETAIL CODE NEEDED
udbJSGenerate 224 DATABASE DB2 UDB FOR UNIX OTHER, DETAIL CODE NEEDED
cdmSpecProdNT 252 HOSTING - DISTRIBUTED APFILER OTHER, DETAIL CODE NEEDED
mfdstBCPProcessBox 255 ACCOUNTING SERVICES MFA UNIX OTHER DETAIL CODE NEEDED
dailyopsTest123 276 HOSTING - DISTRIBUTED HP OPEN VIEW OTHER, DETAIL CODE NEEDED
pacCreateMailNT 291 SYSTEMS MANAGEMENT LOTS OTHER, DETAIL CODE NEEDED
dailyopsJobfail2 306 HOSTING - MAINFRAME DFSORT OTHER, DETAIL CODE NEEDED
psledgerUVTW 347 ACCOUNTING SERVICES PEOPLESOFT GENERAL LEDGER OTHER DETAIL CODE NEEDED

Thanks

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros