Scripting Games, Beginner Event 3, Let’s Get Together

Not much to say about this one – takes the first line from all the text files in c:\scripts and concatenates them into c:\temp\newfile.txt:

get-childitem 'c:\scripts\*.txt'|%{(get-content $_)[0]}>>'c:\temp\newfile.txt'

The Scripting Guy’s solution is better!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s