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
Riddle - solve it if you can numstr Shell Programming and Scripting 1 08-15-2007 01:52 PM
Can AWK solve it ??? emon Shell Programming and Scripting 1 02-23-2005 01:07 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-21-2007
akashag22 akashag22 is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 2
How to solve this

I have to write an script for..

CUST: 123 trans:

some contents

CUST: 1234 trans:
some contents

Now wat i have to do is this:
CUST:123 akash trans:
some contents
CUST:1234 akash1 trans:

I have been able to add name to the number but the format is getting changed like:
CUST:123 akash trans:
some contents

CUST:1234 akash1 trans:


I want to retain the format..... i have used the sed to add names to the numbers and it is shifting the spaces between number and "TRANS" so the format gets changed.I want to keep the format same after adding names to the numbers...

Pleae provide me the solution..
  #2 (permalink)  
Old 07-21-2007
kamitsin's Avatar
kamitsin kamitsin is offline
Registered User
  
 

Join Date: Nov 2006
Location: /dev/null
Posts: 177
use printf command with awk.
  #3 (permalink)  
Old 07-21-2007
akashag22 akashag22 is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 2
can you give me an idea how i should use that.. acutally there are some content between two line named CUST..
  #4 (permalink)  
Old 07-21-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
try this:


Code:
cat file_name |grep "CUST" | awk '{print $1 " AKASH " $3}'

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 03:29 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