ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Append/Concatenate/Merge text files, but prepend filenames

<< < (2/3) > >>

4wd:
Only to look up the Add-Content command, otherwise was just a mashup of other small scripts I've done.

Was trying to get Add-Content to work instead of Out-File since it takes care of character encoding depending on the input files without having to specify it like Out-File.

Couldn't seem to get the pipes right though.

I like PowerShell because it reminds me a lot of ARexx on  Amiga, you can write off the cuff small bits of code that leverage the system and other programs, run them instantly, and get reasonably non-cryptic error messages back when you screw up.
Plus it's part of the system, I don't need to install IDE, compiler, etc, etc.

Edit: DUH! Just found how it's done using Add-Content  :-[
Wonderful what happens when you have a good sleep ...

--- Code: PowerShell ---Add-Content -Path 'output.txt' -Value (Get-Content $_.Fullname)
Modified my original post

Can also throw a Sort in the pipe if a particular order is wanted, eg.

Get-ChildItem ..\*.ps1 | Sort CreationTime | ...
Get-ChildItem ..\*.ps1 | Sort -Descending Length | ...

etc etc

cranioscopical:
I like PowerShell because it reminds me a lot of ARexx on  Amiga
-4wd (October 03, 2018, 05:30 PM)
--- End quote ---
:Thmbsup:

(http://www.rexxla.org/events/2015/presentations/brexx-GergerEva-20141225.pdf)

wraith808:
I like PowerShell because it reminds me a lot of ARexx on  Amiga, you can write off the cuff small bits of code that leverage the system and other programs, run them instantly, and get reasonably non-cryptic error messages back when you screw up.
-4wd (October 03, 2018, 05:30 PM)
--- End quote ---

I was going further back to the source in my memories, i.e. REXXw on OS/2

Plus it's part of the system, I don't need to install IDE, compiler, etc, etc.
-4wd (October 03, 2018, 05:30 PM)
--- End quote ---

Yeah, there is that too.  I use csc quite a bit for that reason too for simple things- no external dependencies.  The right tool for the job  :Thmbsup:

nkormanik:
4wd, wraith808, cranioscopical...  you guys are great.

Thanks for your help.

Skwire, another one done.

c.gingerich:
Guess that’s a no on mine. Well I tried  ;)

I’ll delete the download.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version