Unix/Linux
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs Unix/Linux

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old July 2nd, 2008, 12:30 PM
Stephane CHAZELAS
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
split in bash

2008-07-02, 12:04(-04), Wayne:
[]
>Then, what is the best way to split a string in bash?
>

echo ${s%%,*} # everything up to the last comma in s

No, that's everything up to the *first* comma in s if s contains
a comma or s in full if not (and subject to word splitting,
globbing and echo transformations as you forgot to quote it and
used echo).

${s%,*} for everything up to the last comma (or s in full if s
doesn't contain a comma).

echo ${s,} # everything after the last comma in s
[]

or s in full if s doesn't contain a comma.

--
S

Reply With Quote
Reply

Viewing: Web Development Archives FAQs Unix/Linux > split in bash


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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT