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
Understanding ZFS: Compression iBot Solaris BigAdmin RSS 0 11-19-2008 05:40 PM
A little help understanding FIFOs? deckard Linux 0 11-01-2005 01:46 PM
Understanding traceroutes Bobby IP Networking 2 03-14-2005 05:35 PM
need further understanding of init.d jigarlakhani UNIX for Advanced & Expert Users 1 09-20-2002 03:11 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-22-2009
krishmaths krishmaths is offline
Registered User
  
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 191
Understanding cut

In our old code, we have the below statements

Code:
LAST_FRIDAY=2009-01-16
echo $LAST_FRIDAY|cut -d '"' -f2
And the output of this is 2009-01-16

The delimiter provided in cut statement is not used in the variable. Also, when we give f1 or f3 or f10 or any other field instead of f2, we still get the output 2009-01-16.

Can someone explain this behaviour please?
  #2 (permalink)  
Old 01-22-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,262
As you already said, the delimeter is not used in the variable. Changing the delimeter to "-" might make more sense.
  #3 (permalink)  
Old 01-22-2009
krishmaths krishmaths is offline
Registered User
  
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 191
Got clarified now. The intention of the developer was to use

Code:
LAST_FRIDAY="2009-01-16"
and then cut the second field using delimiter '"'

Sorry for the confusion caused. Thanks!
  #4 (permalink)  
Old 01-22-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,262
I don't get it - even if he did, when you call the value of the variable with echo, the " are gone anyway using them like in your snippet. So there will be still nothing to cut out.
I mean I don't want to take your happyness away heh
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 10:37 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