The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
facing problem in starting a process in background using shell script. dtomar Shell Programming and Scripting 8 04-17-2008 09:11 AM
Facing an issue related to cronjob parindam HP-UX 1 09-13-2006 05:11 PM
please help as i am facing problem with uptime guy009 SUN Solaris 3 06-02-2005 07:59 PM
facing problem with cut command vivekshankar UNIX for Dummies Questions & Answers 3 05-25-2005 01:21 PM
facing a problem in redirection vivekshankar UNIX for Dummies Questions & Answers 4 05-23-2005 01:24 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-09-2008
jisha jisha is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore,India
Posts: 144
Arrow Problem facing with sed and awk

Hi All,

I have a got a problem ..
I have t files as below:

1.txt contains
Code:
-----
-----
-----
column  1,  "cat",
column  24,  "dog",
column  100,  "rat",
-----
-----
-----
2.sh should contain
Code:
-----
-----
-----
awk 'BEGIN { printf ("%1s","cat")}' 
awk 'BEGIN { printf ("%24s","dog")}'
-----
-----
-----
When i execute 2.sh i should get the formatted printed output

I have tried the following codes;

awk '/column/ { print <> }' format.txt > we
where the <> is awk 'BEGIN .....
The problem with this command is I cannot get the lines above or below the search.
i.e only the lines containng "column" will be replaced and written to 2.sh

If i use sed, I cannot get the fileds from the file 1.txt
i.e; In order to get the "%1s" "%100s" from file 1.txt is not possible.

Is their any way we can overcome these two problems ?

thanks in advance
JS

Last edited by Yogesh Sawant; 04-09-2008 at 09:44 AM.. Reason: added code tags
 

Bookmarks

Tags
grep or

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 01:50 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