The UNIX and Linux Forums  

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
divide issue kotasateesh UNIX for Dummies Questions & Answers 1 02-13-2008 02:43 AM
divide with awk tontal Shell Programming and Scripting 1 10-09-2006 08:23 AM
script needs to divide by 2 wereyou Shell Programming and Scripting 2 09-26-2006 08:42 PM
Remove Carriage returns between strings in a field acheepi Shell Programming and Scripting 10 09-24-2005 02:19 PM
How to concatenate two strings or several strings into one string in B-shell? fontana Shell Programming and Scripting 2 08-26-2005 12:58 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 07-17-2006
tonet
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Exclamation divide field in two strings

Hi everybody:
Anybody know how could I divide a field like this:
1234
like 12 34.
thanks in advance.
  #2 (permalink)  
Old 07-17-2006
vish_indian vish_indian is offline
Registered User
  
 

Join Date: Jun 2006
Location: Delhi, India
Posts: 92
Quote:
Originally Posted by tonet
Hi everybody:
Anybody know how could I divide a field like this:
1234
like 12 34.
thanks in advance.

echo "1234" | awk '{ print substr($0,1,2), substr($0,3,2)}'
  #3 (permalink)  
Old 07-17-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,960
Quote:
Originally Posted by tonet
Hi everybody:
Anybody know how could I divide a field like this:
1234
like 12 34.
thanks in advance.
an ugly way of doing it,

Code:
echo "1234" | sed 's/\(..\)\(..\)/\1 \2/'

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 12:27 PM.


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