Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Text processing problem

Reply
 
Old 11-13-2008   #1 (permalink)
Kryten


 
 

Text processing problem

Hi,

I'd really appreciate a steer on how best to accomplish this text
processing conundrum in Powershell.

I have a large text file full of this:-

IDENTITY 1234
ANY

IDSS 03035
XXXX 8
NAME 00 63636
NAME 01 64646
NAME 02 76767
NAME 03 87878
NAME 04
NAME 05 22121
NAME 06
NAME 07 11222
NAME 08
NAME 09 22122

IDENTITY 1235
ANY

IDSS 03035
XXXX 8
NAME 00 54545
NAME 01 32322
NAME 02 67523
NAME 03
NAME 04 67887
NAME 05 23221
NAME 06

I need each NAME to be preceded by it's IDENTITY number. Like this:-

IDENTITY 1234
ANY

IDSS 03035
XXXX 8
1234 NAME 00 63636
1234 NAME 01 64646
1234 NAME 02 76767
1234 NAME 03 87878
1234 NAME 04
1234 NAME 05 22121
1234 NAME 06
1234 NAME 07 11222
1234 NAME 08
1234 NAME 09 22122

IDENTITY 1235
ANY

IDSS 03035
XXXX 8
1235 NAME 00 54545
1235 NAME 01 32322
1235 NAME 02 67523
1235 NAME 03
1235 NAME 04 67887
1235 NAME 05 23221
1235 NAME 06

And so on. There are maye a hundred or so lists like this in the file
that need this treatment.

I'd be really grateful for any assistance.

Many thanks,

Stuart



My System SpecsSystem Spec
Old 11-13-2008   #2 (permalink)
Kryten


 
 

Re: Text processing problem

Marco,

Thats awesome!
Brilliant use of switch/regex.
I wish I coulda thought of it !

Many thanks,
Stuart

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Word Processing problem? :S Software
More text processing. PowerShell
Clear-Content Cmdlet and Processing Lines in Text File PowerShell
ACT! Word Processing Problem? Vista General
Unique error problem - "Some errors occurred while processing -" Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46