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
pass parameter to function vasuarjula Shell Programming and Scripting 3 01-12-2009 08:58 PM
[csh] How to capture output from a command and pass it on to a variable? machinogodzilla Shell Programming and Scripting 3 05-11-2008 10:36 AM
How to pass variables to FUNCTION ? bh_hensem Shell Programming and Scripting 5 05-31-2007 03:54 AM
Pass argument to function Knotty UNIX for Dummies Questions & Answers 1 04-08-2007 09:26 AM
can I pass awk variable to system command? zhynxn Shell Programming and Scripting 2 07-05-2006 12:11 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 06-11-2009
Nishithinfy Nishithinfy is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 8
how to pass variable in NR function used in awk command?

Hi

I want to pass variables with the NR function in awk command.

test_file1 is input file having 500 records.
var1=100.
var2=200

awk -F" " 'NR >= $var1 && NR <= $var2' test_file1 > test_file2.

My end result should be that test_file2 should have records from line number between $var1 and $var2.
Any other commands for it?
 

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 06:51 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