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
Need your suggestion please.. unknown2205 Shell Programming and Scripting 1 11-21-2005 02:45 AM
I want a suggestion camel High Level Programming 6 06-13-2003 06:59 PM
Suggestion tovsky Post Here to Contact Site Administrators and Moderators 1 08-07-2001 08:40 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 01-22-2009
younggun044 younggun044 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
Scripting suggestion

Hello Scripting experts,
I need a very basic suggestion regarding scripting(shell or whtevr).

My requirement is to to generate a file after:
1) Reading a file containing list of names etc.
eg: list is like this
input1 : IN
input2 : IN
.
.
output1: OUT
output2: OUT
.
.
2) Then taking these inputs/outputs wanted to perform some string addition(particular type) on these names to generate new file.
eg:
map( (input1)input , (output1)output )
.
.
.
Basically can add a FOR loop for counting the length(N) of my input list file, and add the above map strings that many times(N).

I know its kinds very simple, tell me if shell scripting would be best to perform such kinda string operation or any other script like perl...

Looking forward for some nice solutions!!
How to do that with simplest usage of commands?
Regards,
Ady
  #2 (permalink)  
Old 01-22-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,262
Not sure if I hit what you want and a bit lengthy, but nevertheless here you go:

Code:
root@isau02:/data/tmp/testfeld> cat infile
input1 : IN
input2 : IN
input3 : IN
input4 : IN
output1: OUT
output2: OUT
output3: OUT
output4: OUT
root@isau02:/data/tmp/testfeld> awk -F: 'BEGIN{a=0;b=0} $2 ~ /IN$/ { in_[a]=$1; a++} $2 ~ /OUT$/ { out_[b]=$1; b++ } END{for( x=0; x<a; x++){print "map( ("in_[x]")input , ("out_[x]")output )" }}' infile
map( (input1 )input , (output1)output )
map( (input2 )input , (output2)output )
map( (input3 )input , (output3)output )
map( (input4 )input , (output4)output )
  #3 (permalink)  
Old 03-06-2009
younggun044 younggun044 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
Thanks.
Actually I want to create new file, such that these variables could be used, eg: my file will be output.file having
logic temp;

module (tempo)
begin
map( (input1 )input , (output1)output )
map( (input2 )input , (output2)output )
map( (input3 )input , (output3)output )
map( (input4 )input , (output4)output )

end

endmodule

Problem is print command like above canot allow me to print like above, with newlines or whtever. I tried with printf command too.
Is there any other way to insert newlines,etc inside print{ }.
Like this
print{"
logic temp;

module (tempo)
begin
map( (input1 )input , (output1)output )
map( (input2 )input , (output2)output )
map( (input3 )input , (output3)output )
map( (input4 )input , (output4)output )

end

endmodule"}
Thanks for giving your feedbacks.
-Ady
  #4 (permalink)  
Old 03-06-2009
younggun044 younggun044 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 3
My actual file to print is big.
So i want best way to direct output values to that big outfile file.
If we can avoid using multiple print statements...
Closed Thread

Bookmarks

Tags
scripting

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 08:31 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