1

I am using the find command to find files of a certain type recursevely in subdirectories. I am trying to send the output from the 'find' command to a text file. However the long file paths returned get split onto multiple lines. I would like to output each file path on a single line.

The command I am using is something like

find /path/to/directories -name *.cdf > filelist.txt

the output I get looks like:

/path/to/directories/directory1/subdir
ectory1/file1.cdf
/path/to/directories/directory1/subdir
ectory1/file2.cdf
/path/to/directories/directory2/subdir
ectory2/file3.cdf

I want my output file to look like:

/path/to/directories/directory1/subdirectory1/file1.cdf
/path/to/directories/directory1/subdirectory2/file2.cdf
/path/to/directories/directory2/subdirectory1/file3.cdf

Any help on how to accomplish this would be much appreciated.

Thanks

4
  • 1
    It is already as you want. It looks like terminal or whatever software you use to view it wraps lines. Just do in terminal cat filelist.txt.
    – Pilot6
    Jun 22, 2015 at 16:55
  • less -S filelist.txt will also show the lines unfolded
    – Germar
    Jun 22, 2015 at 17:01
  • Typically, terminals hold 80 characters, and as described above, will 'soft-wrap' text over 80 characters. This changes as you resize your terminal.
    – earthmeLon
    Jun 22, 2015 at 19:27
  • Yes, you were quite right and it was the software (emacs) wraping the lines. Thank You.
    – dabber
    Jun 22, 2015 at 20:16

1 Answer 1

0

Your Terminal window is too narrow for the lines to be displayed on a single line (per filename).

  • Hold the left ALT-key,
  • while doing so; place mouse pointer over either window side, inside the window,
  • hold down the MIDDLE mouse button
  • and drag to resize the window.

Let go of the mouse button and then ALT as you're content.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .