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



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
retaining file path c00kie88 Shell Programming and Scripting 2 05-22-2008 12:18 AM
retaining the evironment varaibles... priya444 Linux 5 03-23-2007 05:50 AM
Retaining tar.gz after gunzip devs Shell Programming and Scripting 4 02-26-2007 11:41 PM
variable not retaining value gillbates Shell Programming and Scripting 5 11-16-2005 06:16 PM
Retaining value in var for flag. videsh77 Shell Programming and Scripting 4 05-31-2005 10:44 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-15-2009
amicon007 amicon007 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 21
Retaining default OFS

Hi,

I wat to remove the first two columns of the ls -l command:

$ ls -l | awk '{ $1="";$2="";print;}'

The only problem is now the columns of the output is space separated instead of the separators the ls -l originally throws. Can someone tell how to preserve the default OFS of an ls -l command?
Thanks
  #2 (permalink)  
Old 01-15-2009
angheloko's Avatar
angheloko angheloko is offline
Registered User
  
 

Join Date: Jul 2008
Location: Philippines
Posts: 125
Hi amicon007,

I don't think the OFS changed. Can you post a sample output.
  #3 (permalink)  
Old 01-15-2009
SFNYC SFNYC is offline
Registered User
  
 

Join Date: Jun 2008
Location: New York City
Posts: 95
Try this:

Code:
ls -l|cut -d' ' -f4-
  #4 (permalink)  
Old 01-15-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,165
Code:
Adjust "16" for your ls -la output.

ls -l | cut -c16-

Last edited by methyl; 01-15-2009 at 12:01 PM.. Reason: Correct ls option
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0