Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 5
Pass awk results

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, 03:46 PM   #2
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,121

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
you shoul0d read a shell scripting tutorial:
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, 04:01 PM   #3
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.



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 09:17 AM
[SOLVED] Pass Command Result to Awk BarataPT Programming 7 04-15-2011 09:23 AM
[SOLVED] How to get search results to array by awk webhope Programming 5 05-05-2010 11:59 AM
how to pass an external variable to awk??? akitty Programming 7 11-13-2008 08:47 AM
Glibc Pass II Test Results g_goblin Linux From Scratch 0 11-17-2003 12:42 PM

All times are GMT -5. The time now is 01:23 PM.

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