Jump to content

'ls > file.txt'


Recommended Posts

Hi Guys,

for some reason when I redirect ls to a file it always have new lines inserted. even if I try to use ls -m it still inserts new line after about 3 entries. I expect to have one line with all the files listed separated by space... it used to be like this

 

every advice will be appreciated

thanks a lot

bojo

Edited by bojo
Link to comment
Share on other sites

Just try

ls -mw100000 > list.txt

 

(or "man ls" :D )

The -w -Option will let you set the width of the lines. Just set it to infinity and you'll get what you want.

 

echo * > list.txt

should do almost the same.

 

There, of course, are even more complex things you can do with gawk and sed... To format the list differently...

 

Cya.

 

PeterPanic

Edited by PeterPanic
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...