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
NAWK Script not working fine dheeraj19584 Shell Programming and Scripting 3 06-12-2008 08:36 AM
how to access values of awk/nawk variables outside the awk/nawk block? saniya Shell Programming and Scripting 5 05-13-2008 08:37 AM
nawk/ksh help DeltaX Shell Programming and Scripting 0 03-06-2008 03:54 PM
nawk use ctap UNIX for Advanced & Expert Users 2 01-17-2008 06:45 AM
help with Awk or nawk Gerry405 UNIX for Dummies Questions & Answers 2 11-28-2005 01:00 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 02-04-2005
Reza Nazarian Reza Nazarian is offline
Registered User
  
 

Join Date: Jun 2001
Location: Tehran, Iran
Posts: 61
Unhappy help need on nawk script

Dear experts
I have a big file containing several profiles each flagged with "PROFILE" at the beginning of each one. I am trying to use the following command in cshell to seperate each profile and save each one in seperate file. I wrote a script as following:

nawk -v i=0 '{if($1~/PROFILE/) i=i+1, print $0 }' filename > filename$i

I was expecting that it will create different files like file1, file2, ... for each profile but it is not the case. It may need to introduce variable i somehow to shell environment but how can I manage " i " in nawk command can be recognized in shell environment.
Thanks in advances for your advises.
Reza
 

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 02:53 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