LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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



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 05:51 AM.

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
Open Source Consulting | Domain Registration