1

I am trying to append files with a unix command in datastage and its not working.

Unix commands does work.

For examples if there are 5 files in a directory like

/a/file1.txt /a/file2.txt /a/file3.txt /a/file4.txt /a/file5.txt

Second files is not appending in output. I did interchanged files and second file is not in output.

Do you know how files can be appended using AWK or SED, I want to give it a try

eskay
  • 21
  • 1
  • What exactly did you run? `cat`ing multiple files should just output them one after the other. – Mureinik May 08 '15 at 06:11
  • I did cat /a/file1.txt /a/file2.txt /a/file3.txt /a/file4.txt /a/file5.txt > /a/file.txt it is not appending the file2.txt so I am looking for an awk or sed and see if that works – eskay May 08 '15 at 06:26
  • ```cat``` followed by the list of files should work OK. Could it be that the paths are incorrect (e.g. absolute vs. relative paths or something similar)? – Ramón Gil Moreno May 08 '15 at 11:01

1 Answers1

2

This may help you:

find . -type f | xargs cat | tee outputfile.txt

Explanation:

  • find will list the files (the parameters exclude the directories)
  • xargs cat will display the content of each file
  • tee will show the output in the console and write it to the outputfile as well.
  • I had to put the output somewhere else because it read the outputfile and combined it in. Nothing I couldn't handle thanks – danny117 Jan 10 '18 at 22:27