The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help with split Hawks444 Shell Programming and Scripting 1 02-28-2008 06:11 PM
Split a file with no pattern -- Split, Csplit, Awk madhunk UNIX for Dummies Questions & Answers 10 12-17-2007 12:57 PM
split string help senthilk615 Shell Programming and Scripting 4 03-27-2006 07:43 PM
conditional split braindrain Shell Programming and Scripting 5 03-11-2006 03:54 AM
split a string gazingdown Shell Programming and Scripting 3 02-09-2006 05:34 AM

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 08-17-2001
AkumaTay AkumaTay is offline
Registered User
  
 

Join Date: Jul 2001
Location: Malaysia
Posts: 21
Split

Is there a split function in shell? (not awk)

Coz i got a string as input and needed to split it.

eg. input = "abc:123:def:www"

I need to split it into 4 variable which contains abc,123,def,www.

Is there anyway i can do tat?
  #2 (permalink)  
Old 08-18-2001
patvdv's Avatar
patvdv patvdv is offline
Registered User
  
 

Join Date: Jul 2001
Location: Belgium
Posts: 83
cut

cut will do nicely for you:

var1 = $(echo ${input} | cut -f 1 -d ":")
var1 = $(echo ${input} | cut -f 2 -d ":")

etc.
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 06:45 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