How to list the different files in UNIX?

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to list the different files in UNIX?
# 1  
Old 09-23-2014
How to list the different files in UNIX?

Hi ,

I have to find the files from a directory . But the file names are different.

for ex.

I need to find all the files by a single command.

How can i list all these files. Please help me to resolve this.

Thanks in advance.


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 09-23-2014 at 09:52 AM..
# 2  
Old 09-23-2014
Well you look for what they have in common:
_TEST_DATA_ and .dat
so e.g.
ls -al *_TEST_DATA_*.dat |more

This User Gave Thanks to vbe For This Post:
# 3  
Old 09-23-2014
Hi Vbe,

Thanks for your reply ..

sorry , the file name mentioned in the above is wrong

The following is the format ..can you pls help me to solve the issue

Thanks in advance


# 4  
Old 09-23-2014
ls -l TE*_DATA_*.dat

This User Gave Thanks to vbe For This Post:
# 5  
Old 09-23-2014
Hi Vbe,

if that DATA will not be coming , then how can we define the pattern .

The file name is getting build dynamically.

Can you please let me know that how to handle that scenario.

Thanks in advance.

# 6  
Old 09-23-2014
Even dynamicaly you have clues on the filname you are looking for, use what you know will always be in the file names...
You know that the desired files will always end by .dat only many other files may also so it is relevant but not enough, find something else you know that belongs to the file name ( and all wanted files have ! )
This User Gave Thanks to vbe For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need help with UNIX command to get the latest file from list of files with timestamp

Hi All, I have list of files like below with name abcxyz.timestamp. I need a unix command to pick the latest file from the list of below files. Here in this case the lates file is abcxyz.20190304103200. I have used this unix command "ls abcxyz*|tail -1" but i heard that it is not the appropriate... (2 Replies)
Discussion started by: rakeshp
2 Replies

2. UNIX for Advanced & Expert Users

How to list deleted files in UNIX?

Hi All, Its an interview question. I just want to know the answer of below question. 1) How to list deleted files in unix (13 Replies)
Discussion started by: pspriyanka
13 Replies

3. UNIX for Dummies Questions & Answers

Help with ksh script to list files, cp it to another UNIX server

Hi, I'm quite new to ksh scripting, can someone help me with this. Requirements: I need to create a script that list the files from a user input date range. e. g. format of file: *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00* *c1*log.2012-12-22-14-00*... (7 Replies)
Discussion started by: chococrunch6
7 Replies

4. Shell Programming and Scripting

Copy list of files from a keyword list to another directory

Hello, I have a folder with a massive amount of files, and I want to copy out a specific subset of the files to a new directory. I would like to use a text file with the filenames listed, but can't get it to work. The thing I'm hung up on is that the folder names in the path can and do have... (5 Replies)
Discussion started by: twjolson
5 Replies

5. UNIX for Advanced & Expert Users

List of all files in a UNIX system

Hello, I have a special request. I'm trying to compile a list of files from several distributions of UNIX systems (especially after a fresh or roughly fresh install). Basically, I need the output of the command "find /" when logged in as root. $ su $ find / > list_of_files I am especially... (0 Replies)
Discussion started by: microwerx
0 Replies

6. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

7. Shell Programming and Scripting

find list of files from a list and copy to a directory

I will be very grateful if someone can help me with bash shell script that does the following: I have a list of filenames: A01_155716 A05_155780 A07_155812 A09_155844 A11_155876 that are kept in different sub directories within my current directory. I want to find these files and copy... (3 Replies)
Discussion started by: manishabh
3 Replies

8. UNIX for Advanced & Expert Users

help with sorting sequence in Unix C:sort -t ':' +0 -1 -n +1 -2 +2 -3 -o list list

Hi List is 000|2008-07-17|556543|RTJ|35-RTGJ|EYT 465|2008-11-10|567789|GHJ|45-DGHH|ETU 533|2008-09-06|567789|GHJ|45-DGHH|ETU How does it do it? sort -t ':' +0 -1 -n +1 -2 +2 -3 -o list list (6 Replies)
Discussion started by: gurvinder
6 Replies

9. UNIX for Dummies Questions & Answers

counting a list of string in a list of txt files

Hi there! I have 150 txt files named chunk1, chunk2, ........., chunk150. I have a second file called string.txt with more than 1000 unique strings, house, dog, cat ... I want to know which command I should use to count how many times each string appears in the 150 files. I have tried... (4 Replies)
Discussion started by: Pep Puigvert
4 Replies

10. Shell Programming and Scripting

command unix to list all files created since n month ago

Hello, I want to list all files that were created since 3 month ago. it exist a unix command to do it ? thank you (8 Replies)
Discussion started by: yacsil
8 Replies
Login or Register to Ask a Question

Featured Tech Videos