![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto copy for files from folder to folder upon instant writing | Bashar | UNIX for Advanced & Expert Users | 2 | 08-21-2008 03:44 PM |
| Parse the .txt file for folder name and FTP to the corrsponding folder. | MeganP | Shell Programming and Scripting | 3 | 07-03-2007 02:54 PM |
| getting a file name from a folder | u263066 | Shell Programming and Scripting | 4 | 08-14-2006 12:10 PM |
| pickup file from folder | ram2s2001 | Shell Programming and Scripting | 0 | 03-07-2006 02:02 AM |
| Deleting the file in a folder | srivsn | Shell Programming and Scripting | 2 | 12-14-2005 09:05 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
file name in folder
here is the few commond i am doing: Code:
$ ls -l
total 6
drwxrwxr-x 2 dv1gfp dv1gfp 1024 Oct 12 09:57 archive
-rw-r--r-- 1 odv1gfp oradba 1805 Oct 12 09:56 Schroders.CSV
$ ls -lrt * | awk '{print $9}'|grep -v "^d"
Schroders.CSV
test.dat
SANJIT4.dat
CITI5.dat
ANAND6.dat
ANA8.dat
ANA7.dat
3.dat
2.dat
export.CSV_1
export.CSV
export.csv.orig
$
now i want to know the file name in this folder, but giving this command listing out all files within archive folder also. Can anyone help me out, which command should I release for this. |
|
||||
|
ls -lrt | grep -v "^d" | awk '{print $9}'
remove * from ls command and shift grep one step ahead... because if you put awk first, it takes only the 9 th column ( i.e file name )... then no where you can find "^d" to remove lines. |
|
||||
|
Just try... the following two commands
ls -lrt *.CSV ls -lrt In the second command you will find additional line something like "total 6"... this is causing the blank line... if you want to filter this out, add change the grep to egrep -v "^d|^total" |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|