The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-22-2009
dennis.jacob dennis.jacob is offline Forum Advisor  
dj - the student
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 596
Quote:
Originally Posted by mnmonu View Post
Hi
When I tried this command on

[osbadmin@qa1 cp]$ ll
total 1272
-rw-rw-r-- 1 osbadmin osbadmin 0 Apr 22 14:38 a b
-rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 SANITY_TEST
-rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 Success 123333
-rw-r--r-- 1 osbadmin osbadmin 427701 Apr 22 12:06 Success 123333 (1)
[osbadmin@qa1 cp]$
it gives

[osbadmin@qa1 cp]$ val="\""; ls -ltr | awk -v var=$val '{ORS=" ";print var $NF var; }'
"1272" "(1)" "123333" "SANITY_TEST" "b" [osbadmin@qa1 cp]$

I have to get output as "a b" "SANITY_TEST" "Success 123333" "Success 123333 (1)"

Please help me.........
Try this:

Code:
ls -ltr | sed '/^-/!d'  |  sed 's/\(.*\):\([0-9]*\) \(.*\)/\"\3\"/' | tr "\n" " "