Re: Nmap results in spreadsheet format

From: Eric Paynter (eric@arcticbears.com)
Date: Thu Jun 17 2004 - 20:01:32 EDT


On Thu, June 17, 2004 8:00 am, Bill Z. said:
> On Tue, 15 Jun 2004, Eric Paynter wrote:
>> On Mon, June 14, 2004 11:22 am, Bill Z. said:
>>> echo "<table>" ; grep "^[0-9*]" nmap-out | awk '{print "<tr><td>" $1 \
>>> "<td>" $2 "<td>" $3}'; echo "</table>" > nmap-out.xls
>>
>> with my shell, the redirect to nmap-out.xls only applied to the last
>> command. The following fixes [...]
>>
>> echo "<table>" > nmap-out.xls
>> grep "^[0-9*]" nmap-out | awk '{print "<tr><td>" $1 \
>> "</td><td>" $2 "</td><td>" $3 "</td></tr>"}' nmap-out.xls
>> echo "</table>" >> nmap-out.xls
>
> I only used ONE command (note the blackslash), so it doesn't make
> sense that the redirect "only applied to the LAST command".

By commands, I meant the parts separated by semicolons. I ran it using
bash and it only redirected the part after the last semicolon. i.e. I got
"</table>" in my file while the rest went to stdout.

I could have done it with semicolons to make it one "command" (using your
meaning for the word) - I didn't simply for layout. If you prefer:

echo "<table>" > nmap-out.xls ; \
grep "^[0-9*]" nmap-out | awk '{print "<tr><td>" $1 \
"</td><td>" $2 "</td><td>" $3 "</td></tr>"}' nmap-out.xls ; \
echo "</table>" >> nmap-out.xls

Now it's one "command" that still sends all output to the same file using
my version of bash... :-)

-Eric

--
arctic bears - affordable email and name services @yourdomain.com
http://www.arcticbears.com


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:53:56 EDT