Browse directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Browse directory
# 1  
Old 11-26-2015
Browse directory

friends of mine I have the following problem:

in a direct I have a file list, for example:

Code:
-rw-rw-r--  1 satvercl2 desa      6620 nov 26 15:35  prueba1.txt
-rw-rw-r--  1 satvercl2 desa      6620 nov 26 15:35  prueba2.txt
-rw-rw-r--  1 satvercl2 desa      6620 nov 26 15:35  prueba3.txt
-rw-rw-r--  1 satvercl2 desa      6620 nov 26 15:35  prueba4.txt

I need to save to a file only the file name example:

Code:
prueba1.txt
prueba2.txt
prueba3.txt
prueba4.txt

I am using ls guadar -latr but I can not name only ejemplo :

Code:
ls -latr prueba*.txt > tmp.tmp

# 2  
Old 11-26-2015
Please look at the ls man page on your system (using man ls) to determine if you need any of those options. You definitely do not want the l option (which produces long format listings).

The simplest solution to what you said you are trying to do would just be:
Code:
ls prueba*.txt > tmp.txt

With most shells on most systems, the following would be faster since printf is usually a shell built-in and ls usually is not a shell built-in:
Code:
printf '%s\n' prueba*.txt > tmp.txt

Note that in both of these examples I changed the name of your output file from tmp.tmp to tmp.txt, but you can use whatever name you want.
These 2 Users Gave Thanks to Don Cragun For This Post:
# 3  
Old 11-26-2015
Perfect, thank you very much .

This page is the bible !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Browse in commands

Hi, On Linux Linux 3.10.0-693.21.1.el7.x86_64 How to enable : history-search I did the following without success: in my .inputrc, like so: "\e And .profile: export INPUTRC=~/.inputrc Thanks. (1 Reply)
Discussion started by: big123456
1 Replies

2. Ubuntu

how to browse the website which uses windows media player?

Hi all, you know some websites use the windows media player to play video,how can i browse these websites in Ubuntu?Any plugin?:) (4 Replies)
Discussion started by: homeboy
4 Replies

3. UNIX for Dummies Questions & Answers

Browse for files through oracle forms placed in unix server

I use a forms application where I develop the forms(Oracle 6i) in windows server and compile(Oracle 9i) the same in Unix server. The whole forms application executables are placed in Unix. My requirement is to upload data from excel sheet to oracle tables using Oracle forms. I have developed the... (0 Replies)
Discussion started by: malinideepa
0 Replies

4. UNIX for Dummies Questions & Answers

unable to browse internet in linux (railwire dialup connection)

Hi Gurus, Good morning . I have a railwire internet connection(dial up).I am able to access internet in windows xp .but in windows xp every time i restart my pc i have to manually right click the "railwire"icon and then click "connect, after this i am just getting connected to the internet. But... (4 Replies)
Discussion started by: sanjay.login
4 Replies

5. UNIX for Dummies Questions & Answers

Browse Web pages through command line

Is there any way to browse web pages while on the command line? I know wget can download pages, but I was wondering if there was an option other than that. (2 Replies)
Discussion started by: vroomlicious
2 Replies

6. AIX

how to browse a web site using script

hi guys, ok this script, i am trying to browse a http site and store the output in a text file ... when i run the script , i get a http compatibility error. does any1 have a good solution to contact a http server and save the html in a text file.. i know the result comes with html tags. ... (4 Replies)
Discussion started by: kirantalla
4 Replies

7. Shell Programming and Scripting

how to best browse man pages?

guys...usually we simply browse the man pages with "man commandName" are there better ways to browse the man pages? i also see many underlined words in man pages...does they have some special signifigance like the one in html.. i.e can they be directly refered for complete reference? is... (5 Replies)
Discussion started by: RishiPahuja
5 Replies
Login or Register to Ask a Question