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
function in UNIX luna_soleil Shell Programming and Scripting 8 02-26-2009 01:22 PM
Recursive function call problem netresearch Shell Programming and Scripting 2 01-28-2009 07:30 AM
Problem with Recursive function malle Shell Programming and Scripting 4 02-03-2007 10:40 AM
recursive function bebop1111116 High Level Programming 1 10-30-2006 08:12 PM
Performing a non-recursive find in Unix christallott UNIX for Advanced & Expert Users 3 09-06-2002 10:13 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 04-17-2009
goutam_igate goutam_igate is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 15
Recursive function in unix

Can someone tell me, how do i write a recursive code using shell ( eg like 'for' loop in C) which outputs the record to a database table as one row per iteration?
  #2 (permalink)  
Old 04-17-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,880
Which OS?
Which shell?
What database?
And a for loop has nothing to do with recursion. Recursion would mean a function that calls itself, useful for Fibonacci series or XML parsing.
  #3 (permalink)  
Old 04-17-2009
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
You mean "iterative" not "resursive".
  #4 (permalink)  
Old 04-18-2009
goutam_igate goutam_igate is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 15
I meant iterative...My requirement is to find text between specific strings using awk send this to csv file then move ahead and find the next string send it to csv and so on till the end of the source file...Hope i am clear in explaining..
  #5 (permalink)  
Old 04-18-2009
figaro figaro is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 268
If there is only one CSV file per execution of your script then you are likely to find many examples if you google for "echo grep shell". Perhaps you have a draft version of your code or script we can review?
  #6 (permalink)  
Old 04-18-2009
goutam_igate goutam_igate is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 15
No requirement is of same csv file for all iterations so for that 'echo grep shell' will work?
No i am still figuring out on how to build the code but the idea is to use only one csv output file. Let me simplify a bit.
Source: source.txt say it contains a,1,b,a,2,b,a,3,b
In code: awk '/a/,/b/' source.txt
Target: target.csv

which should get output as
1 ,one
2 ,two
3, three
  #7 (permalink)  
Old 04-18-2009
figaro figaro is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 268
Quote:
Originally Posted by goutam_igate View Post
No requirement is of same csv file for all iterations so for that 'echo grep shell' will work?
I meant this: echo grep shell - Google Search. It should help you get started.
Closed Thread

Bookmarks

Tags
awk, comma-delimited, csv

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