cut command | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

cut command

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-04-2006
annelisa annelisa is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 13 July 2006, 11:13 AM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
PHP cut command

I have to cut a string using a multiple character delimiter.

I use -d'XP_' -f2
But delimiter is invalid ????

( I have tried -d 'XP_' or -d"XP_" or -d "XP_" . Same error

Any idea, someone to help.
Sponsored Links
    #2  
Old 07-04-2006
Nicol Nicol is offline
Registered User
 
Join Date: Sep 2003
Last Activity: 14 February 2012, 9:27 AM EST
Location: Paris
Posts: 181
Thanks: 1
Thanked 0 Times in 0 Posts
Hi ,

cut -f 2 -d XP_

normally it takes the second field and put "XP_" as separator

this is what you want ?

Christian
Sponsored Links
    #3  
Old 07-04-2006
annelisa annelisa is offline
Registered User
 
Join Date: Jul 2006
Last Activity: 13 July 2006, 11:13 AM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
seems not working

a=TEXT_TEXT_XP_4.3.2A ( I'd like to extract 4.3.2A )

I'm typing :
echo $a |cut -f2 -d XP_

and error is cut:invalid delimiter
    #4  
Old 07-04-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
kharkovpromenade.com.ua
 
Join Date: Jun 2006
Last Activity: 10 December 2011, 9:33 AM EST
Posts: 360
Thanks: 0
Thanked 9 Times in 8 Posts
I've become
cut: the delimiter must be a single character (GNU cut 5.3.0)
Try sed or something like it
Sponsored Links
    #5  
Old 07-04-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
kharkovpromenade.com.ua
 
Join Date: Jun 2006
Last Activity: 10 December 2011, 9:33 AM EST
Posts: 360
Thanks: 0
Thanked 9 Times in 8 Posts
$ echo TEXT_TEXT_XP_4.3.2A | sed -e 's/^.*XP_//'
Sponsored Links
    #6  
Old 07-04-2006
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Ex-Moderator
 
Join Date: Nov 2004
Last Activity: 16 December 2013, 12:55 AM EST
Location: Bahrain
Posts: 592
Thanks: 3
Thanked 8 Times in 3 Posts
From cut manual:
Quote:
UX:cut:ERROR:no delimiter
The char argument to the -d option is too long, usually because
more than one character was specified.
For your specific problem you could use:
Code:
echo "TEXT_TEXT_XP_4.3.2A" | cut -d_ -f4

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing command output from one command to the next command in cshell kaaliakahn UNIX for Dummies Questions & Answers 2 02-10-2012 04:59 PM
unix command : how to insert text at the cursor location via command line? xib.be UNIX for Advanced & Expert Users 0 12-22-2010 05:45 PM
Need help! command working ok when executed in command line, but fails when run inside a script! 4dirk1 Shell Programming and Scripting 4 12-02-2010 05:47 AM
awk command in script gives error while same awk command at prompt runs fine: Why? catalys Shell Programming and Scripting 4 09-20-2010 10:07 PM
awk/sed Command : Parse parameter file / send the lines to the ksh export command rajan_san Shell Programming and Scripting 4 11-06-2008 12:29 PM



All times are GMT -4. The time now is 12:45 PM.