Sponsored Content
Top Forums Shell Programming and Scripting Trying to get 5th field from ls -l output Post 302911530 by John K on Friday 1st of August 2014 08:08:27 AM
Old 08-01-2014
Trying to get 5th field from ls -l output

Bash Shell/Oracle Linux 6.4

Following is an ls -lh output. Files which are equal to or higher than 1Gigabytes will displayed with G in the 5th column of the output.
I am trying to find all files which are equal to or higher than 1G

File sizes are shown in the 5th column. So, I tried
Code:
cut -d' ' -f5

. But it returned blank lines, so I think it may be counting each individual space as a field when there is more than one space together


Code:
ls -lrth *.dmp | cut -d' ' -f5

-rwxrwxrwx 1 migration gdma       32K Mar 15 17:38 MIG_DUMPFILE_POL_20140315_173834.dmp
-rw-r----- 1 oracle    asmadmin  1.7G Mar 17 09:27 MIG_DUMPFILE_OM411_20140317_091908.dmp
-rw-r----- 1 oracle    asmadmin   28K Mar 20 15:36 MIG_DUMPFILE_AI317_20140320_153623.dmp
-rw-r----- 1 oracle    asmadmin   74M Mar 20 16:55 MIG_STG_UIM_MSISDN_TGT_NM423_20140320_165437.dmp
-rw-r----- 1 oracle    asmadmin   68M Mar 20 17:02 MIG_STG_UIM_MSISDN_TGT_NM424_20140320_170224.dmp
-rw-r----- 1 oracle    asmadmin   92M Mar 20 17:11 MIG_STG_UIM_MSISDN_TGT_NM425_20140320_171042.dmp
-rw-r----- 1 oracle    asmadmin  231M Mar 21 16:14 MIG_DUMPFILE_STG_LKP_BSS_BA_20140321_161411.dmp
-rw-r----- 1 oracle    asmadmin   93M Mar 21 16:34 MIG_DUMPFILE_OM412_20140321_163354.dmp
-rw-r----- 1 oracle    asmadmin  446M Mar 21 20:00 MIG_DUMPFILE_AM410_20140321_195913.dmp
-rw-r----- 1 oracle    asmadmin  146M Mar 21 20:08 MIG_DUMPFILE_AM411_20140321_200815.dmp
-rw-r----- 1 oracle    asmadmin  319M Mar 21 20:12 MIG_DUMPFILE_STG_LKP_BSS_CA_20140321_201126.dmp
-rw-r----- 1 oracle    asmadmin   28K Mar 23 14:27 MIG_DUMPFILE_AI317_20140323_142700.dmp
-rw-r----- 1 oracle    asmadmin   36K Mar 24 09:53 MIG_DUMPFILE_TEST_20140411_060116.dmp
-rwxrwxrwx 1 migration gdma      537M Mar 24 10:20 MIG_DUMPFILE_LKP_ast_20140324_102003.dmp
-rwxrwxrwx 1 migration gdma       56K Mar 24 10:33 MIG_DUMPFILE_LKP_LTE1_20140324_103354.dmp
-rwxrwxrwx 1 migration gdma       56K Mar 24 10:34 MIG_DUMPFILE_LKP_LTE2_20140324_103429.dmp
-rw-r----- 1 oracle    asmadmin  1.4G Mar 26 00:36 MIG_DUMPFILE_AM414_20140326_003118.dmp
-rw-r----- 1 oracle    asmadmin   42M Mar 26 01:45 MIG_DUMPFILE_SR414_20140326_014525.dmp
-rw-r----- 1 oracle    asmadmin  475M Mar 26 02:24 MIG_DUMPFILE_OM410_20140326_022241.dmp
-rw-r----- 1 oracle    asmadmin  2.4G Mar 26 09:27 MIG_DUMPFILE_OM411_20140326_091908.dmp

Expected output:
Code:
-rw-r----- 1 oracle    asmadmin  1.7G Mar 17 09:27 MIG_DUMPFILE_OM411_20140317_091908.dmp
-rw-r----- 1 oracle    asmadmin  1.4G Mar 26 00:36 MIG_DUMPFILE_AM414_20140326_003118.dmp
-rw-r----- 1 oracle    asmadmin  2.4G Mar 26 09:27 MIG_DUMPFILE_OM411_20140326_091908.dmp

Can this be acheived without awk or sed ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Retrieve 5th Field to Last Field !!

I have a script which retrieves certain fields from a text file using awk. The delimiter used is white space. cat /home/eis/boss/OPS|while read LINE do crdno=`echo $LINE | awk '{print $1}'` atm=`echo $LINE | awk '{print $2}'` seq=`echo $LINE | awk '{print $3}'` amount=`echo $LINE | awk... (3 Replies)
Discussion started by: jobbyjoseph
3 Replies

2. Shell Programming and Scripting

Can we use 'tr' command to print 5th column of output of 'ls -l'

Hi All, I know awk command can do it, but can we use tr command to print 5th column of out put 'ls -l' command???? Regards, Nidhi... (4 Replies)
Discussion started by: Nidhi2177
4 Replies

3. Shell Programming and Scripting

Compare two files Field by field and output the result in another file

Hi Friends, Need Help. I have file1.txt as File1.txt |123|A|7267|Hyder|Cross|Sell|7801 |995|A|7051|2008|Lunar|New|Year|Promotion|7801 |996|A|7022|Q108|Targ|Prospect|&|SSCC|Savings|Promo|7801 |997|A|7182|Q1|Feb-Apr|08|Credit|ITA|PA|SBA|Campaign|7801 File2.txt... (7 Replies)
Discussion started by: i150371485
7 Replies

4. Shell Programming and Scripting

Plz Help. Compare 2 files field by field and get the output in another file.

Hi Freinds, I have 2 files . one is source.txt and second one is target.txt. I want to keep source.txt as baseline and compare target.txt. please find the data in 2 files and Expected output. Source.txt 1|HYD|NAG|TRA|34.5|1234 2|CHE|ESW|DES|36.5|134 3|BAN|MEH|TRA|33.5|234... (5 Replies)
Discussion started by: i150371485
5 Replies

5. UNIX for Dummies Questions & Answers

awk - output field separator

In awk, how do I print all fields with a specified output field separator? I have tried the following, which does not print the output FS: echo a b c d | awk 'BEGIN{OFS = ";"}{print $0}' (3 Replies)
Discussion started by: locoroco
3 Replies

6. UNIX for Dummies Questions & Answers

Ps output field extract

This is the output from ps -ef cmd . I have to extract the fourth (C) and the seventh (TIME) field root 3932344 3801216 Apr 08 - 0:00 /usr/sbin/rsct/bin/ERrmd root 3997836 1 0 Apr 08 - 0:00 /usr/sbin/uprintfd root 4128894 3801216 0 Apr 08 - 0:09... (3 Replies)
Discussion started by: Anu_1
3 Replies

7. Shell Programming and Scripting

How to remove alphabets/special characters/space in the 5th field of a tab delimited file?

Thank you for 4 looking this post. We have a tab delimited file where we are facing problem in a lot of funny character. I have tried using awk but failed that is not working. In the 5th field ID which is supposed to be a integer only of that file, we are getting corrupted data as below. I... (12 Replies)
Discussion started by: Srithar
12 Replies

8. Shell Programming and Scripting

sed : Second field not getting displayed in the output

Hi , I have a file (input.txt) with the below contents : 20150223T12:00:25 hostnamex 20150716T10:40:54 hostnamey 20150202T20:08:03 hostnamez I want the output to be like below i.e excluding the timestamp ( THH:MM:SS) in the above file as follows : 20150223 hostnamex 20150716... (2 Replies)
Discussion started by: rahul2662
2 Replies

9. Shell Programming and Scripting

Display combination of 4 field uniqe record and along with concatenate 5th and 6th field.

Table ACN|NAME|CITY|CTY|NO1|NO2 115|AKKK|ASH|IND|10|15 115|AKKK|ASH|IND|20|20 115|AKKK|ASH|IND|30|35 115|AKKK|ASH|IND|30|35 112|ABC|FL|USA|15|15 112|ABC|FL|USA|25|20 112|ABC|FL|USA|25|45 i have written shell script using cut command and awk programming getting error correct it and add... (5 Replies)
Discussion started by: udhal
5 Replies

10. UNIX for Dummies Questions & Answers

Combine Similar Output from the 2nd field w.r.t 1st Field

Hi, For example: I have: HostA,XYZ HostB,XYZ HostC,ABC I would like the output to be: HostA,HostB: XYZ HostC:ABC How can I achieve this? So far what I though of is: (1 Reply)
Discussion started by: alvinoo
1 Replies
jfs_logdump(8)						  JFS utility - journal log dump					    jfs_logdump(8)

NAME
jfs_logdump - dump a JFS formatted device's journal log SYNOPSIS
jfs_logdump [ -a ] device DESCRIPTION
jfs_logdump dumps the contents of the journal log from the specified JFS formatted device into output file ./jfslog.dmp. device is the special file name corresponding to the actual device from which the journal log will be dumped (e.g. /dev/hdb1 ). jfs_logdump must be run as root. OPTIONS
-a Dump the entire contents of the journal log instead of just the committed transactions since the last synch point. EXAMPLE
Dump the entire JFS journal log from the 3rd partition of the 2nd hard disk into ./jfslog.dmp: jfs_logdump -a /dev/hdb3 REPORTING BUGS
If you find a bug in JFS or jfs_logdump, please report it via the bug tracking system ("Report Bugs" section) of the JFS project web site: http://jfs.sourceforge.net/ Please send as much pertinent information as possible, including any jfs_logdump error messages and the complete output of running jfs_fsck with the -v option on the JFS device. SEE ALSO
jfs_fsck(8), jfs_mkfs(8), jfs_fscklog(8), jfs_tune(8), jfs_debugfs(8) AUTHORS
Barry Arndt (barndt@us.ibm.com) William Braswell, Jr. jfs_logdump is maintained by IBM. See the JFS project web site for more details: http://jfs.sourceforge.net/ October 29, 2002 jfs_logdump(8)
All times are GMT -4. The time now is 09:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy