LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 06-09-2012, 11:49 AM   #1
nuser
LQ Newbie
 
Registered: Jun 2012
Distribution: open suse 12.2
Posts: 17

Rep: Reputation: Disabled
how to using regular shell variable inside awk


After many experiments, I need help!Please tell me how to work the following example..
Code:
var=$(cat t.log|awk '!/</'|tail -1) 
cat t.log|awk '/$var/,0'
awk not see $var!Why? And most important how to do it?

The main task is a list of url addresses (equal) to remove those whose port is serial
examle:
Code:
http://ex.com:101
http://ex.com:105
http://ex.com:103
http://ex.com:11 #for remove
http://ex.com:12 #
http://ex.com:13 #
http://ex.com:14 #
 
Old 06-10-2012, 06:35 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,227
Blog Entries: 29

Rep: Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432Reputation: 2432
Moderator response

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
using regular shell variable inside awk nuser Linux - General 1 06-10-2012 07:38 AM
[SOLVED] awk: how can I assign value to a shell variable inside awk? quanba Programming 6 03-23-2010 02:18 AM
shell command using awk fields inside awk one71 Programming 6 06-26-2008 04:11 PM
Using Shell variable inside the C program Varsha_vdd Linux - Newbie 5 06-17-2008 09:42 AM
How to acess Variable defined in perl script inside an awk call sumin Programming 3 04-26-2007 05:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration