LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-02-2014, 04:35 PM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Rep: Reputation: 5
Pass awk results


outit=''
wget http://theaddress.html
$outit=awk '/^I=/{i=$0}/^Data1/{print i,$0}' file.txt
$outit=awk '/^I=/{i=$0}/^Data2/{print i,$0}' file.txt
$outit=awk '/^I=/{i=$0}/^Data3/{print i,$0}' file.txt

I am trying to retrieve some data with the awks above. The data is retrieved, but I need to append everything to a variable to then send in an email. I can't get the outiit to collect the data.
 
Old 06-02-2014, 04:46 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,028

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
you shoul0d read a shell scripting tutorial:
Code:
outit=''
outut=`wget -q -O - http://theaddress.html`
outit="$outit `awk '/^I=/{i=$0}/^Data1/{print i,$0}' file.txt`"
outit="$outit `awk '/^I=/{i=$0}/^Data2/{print i,$0}' file.txt`"
outit="$outit `awk '/^I=/{i=$0}/^Data3/{print i,$0}' file.txt`"
not exactly sure what you are after so i made alot of assumptions. also the awk can probably be consolidated to one command but without seeing the data i'm not sure how.
 
Old 06-02-2014, 05:01 PM   #3
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
I have been through two shell scripting tutorials, but I am also an IBM assembler and cobol programmer, as well as a MS C++/Pascal programmer. Learning a new language is not easy and it is easy to get code techniques mixed up. It is a burden to have to learn bash script now.

Thanks.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Pass search results to awk, and use awk output to search other files bspears1 Linux - Newbie 8 07-21-2012 10:17 AM
[SOLVED] Pass Command Result to Awk BarataPT Programming 7 04-15-2011 10:23 AM
[SOLVED] How to get search results to array by awk webhope Programming 5 05-05-2010 12:59 PM
how to pass an external variable to awk??? akitty Programming 7 11-13-2008 09:47 AM
Glibc Pass II Test Results g_goblin Linux From Scratch 0 11-17-2003 01:42 PM


All times are GMT -5. The time now is 12:30 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