Sponsored Content
Full Discussion: awk syntax help
Top Forums Shell Programming and Scripting awk syntax help Post 302353068 by streetfighter2 on Monday 14th of September 2009 12:18:28 PM
Old 09-14-2009
awk syntax help

I don't get correct output when I run this command line:

nmap -sP failedhost.com | grep -i failed | awk -F '{print $6}'

I basically want it to return 'failedhost.com' but its just showing the output of the nmap scan.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Awk Syntax

I have written many awk commands which go in multiple lines. I have this confusion many times. Some time they work if i dont terminate them with "\" but some time error. Some time in "if" statements between if and else if i dont use ";" it gives error but sometimes it doesnt. The below... (4 Replies)
Discussion started by: pinnacle
4 Replies

2. Shell Programming and Scripting

AWK syntax

Hi I am trying to understand AWK syntax so I tried this command which gives me the home directory of root awk 'BEGIN { FS = ":"} {if ($1 == "root") print $6 }' /etc/passwd I would know what are the following commands doing. The first one prints all /etc/passwd, second prints nothing. ... (4 Replies)
Discussion started by: wakatana
4 Replies

3. UNIX for Dummies Questions & Answers

awk syntax

Little bit confusing while using awk :confused::confused: In Sed while pattern search we can use "(double quotes) i mean $a=hello $cat file.txt |sed -n "/$a/p"this thing work fine But if i use it in awk it's not working How could i do the substitution of pattern by a variables and the... (1 Reply)
Discussion started by: posix
1 Replies

4. Shell Programming and Scripting

AWK syntax help

i have a ksh code that needs to be written in AWK. can someone please help me here? :( if }" | grep -c "$2") -gt 0 ] ; then print - "found $2 in array ignore" else print - "did not find $2 in array ignore" fi ignore=4ty56r ignore=er45ty . . . ignore=frhtg2 (27 Replies)
Discussion started by: usustarr
27 Replies

5. AIX

Help with syntax using AWK

I have a file which is comma separated and has quotes. I can use this command and awk -F"," '{ if ($4=="01" print $0 }' test.txt But this doesn't fetch me the data.since it has quotes. If the data has no quotes,the above command works fine. In Unix you can skip quote \" but this doesn't work.... (7 Replies)
Discussion started by: ganesnar
7 Replies

6. Shell Programming and Scripting

awk syntax

Hi I have a bash file which will split a big file to many small files. But I got a syntax error.H="$(head -1 CCC.tped)" awk 'print $0 > $1 ".tped"' CCC.tped for f in $(ls *.tped); do echo "$H\n" "$(cat $f)" >$f; done And -bash-4.1$ bash split awk: print $0 > $1".tped" awk: ^ syntax error... (3 Replies)
Discussion started by: zhshqzyc
3 Replies

7. Shell Programming and Scripting

AWK Function syntax

Hi, I would like to know what is the correct syntax to perform a function in awk. Although I have seen several examples, not get it to work, this is what I'm trying: #!/bin/bash awk function multi (number) { return number * 3 } print multi (4)Thanks (2 Replies)
Discussion started by: Godie
2 Replies

8. Shell Programming and Scripting

Syntax Problem with awk

Hello, I have perl script,which take some part of data in the file. the below command works fine in normal cmd prompt. `awk '/CDI/ && // && !/Result for/ {print $3 $5 > "final.txt"}' datalist.txt`; `nawk -F"" '{print $2}' finalcdi.txt`; But not working. Please use code tags, thanks. (5 Replies)
Discussion started by: rasingraj
5 Replies

9. Shell Programming and Scripting

Help with the awk syntax

Hello Experts: While writing a script to help one of the posts on here, I end up writing a wrong one. I am very much eager to know how this can be corrected. Aim was to not print specified columns - lets say out of 100 fields, need to print all but 5th, 10th, 15th columns. Someone already... (13 Replies)
Discussion started by: juzz4fun
13 Replies

10. Shell Programming and Scripting

Awk: syntax error

awk -F, ' NR>1 { BEGIN{ chr=$2 } END{ for (k in chr) {print k} } } ' $gene_file I've a really simple code. I want to store gene name and it's chromosome and in the end print them. I'm skipping line one as it contains headers. But I don't know why I get error as: (2 Replies)
Discussion started by: genome
2 Replies
GENLIST.MAN.1(1p)					User Contributed Perl Documentation					 GENLIST.MAN.1(1p)

NAME
Genlist - ping scanner SYNOPSIS
genlist [Input Type] [Scan Options] [General Options] DESCRIPTION
Genlist is a program that returns a list of hosts that responding to ping probes. Thus, this list can be used to perform an scan of these machines using PBNJ or Nmap. Apart of PBNJ 2.0 suite of tools to monitor changes on a network. OPTIONS
Usage: genlist [Input Type] [General Options] Input Type: -s --scan <target> Ping Target Range ex: 10.0.0.* Scan Options: -n --nmap <path> Path to Nmap executable --inter <interface> Perform scan using non default interface General Options: -v --version Display version -h --help Display this information Send Comments to Joshua D. Abraham ( jabra@ccs.neu.edu ) EXAMPLE OF GENLIST USED WITH PBNJ
$ ./genlist -s 10.0.0.* > iplist $ sudo ./scanpbnj -i iplist EXAMPLE OF GENLIST USED WITH NMAP
$ ./genlist -s 10.0.0.* > iplist $ sudo ./nmap -iL iplist INPUT TYPE
-s <target> Ping Target Range ex: 10.0.0.* The ping scan is a useful method of only scanning the host that are responding to ICMP echo requests. This scan basically takes the host that respond to ping and prints them. This is useful in combining the result with a PBNJ or Nmap scan because no time is wasted in scanning hosts that do not respond. SCAN OPTIONS
--interface <intface> This option sets an alternative interface for performing the scan. This is useful when you have multiple interfaces on a machine with restrictions on which devices can access certain IP ranges. -n --nmap <path> Use an alternative Nmap rather than Nmap located in the your path. This is useful if you have multiple version of Nmap installed on a system or if you are testing a new version of Nmap. Remember that if you are using a newly compiled version of Nmap that you need to export NMAPDIR to the location that Nmap was compiled in. Thus, if you have compiled Nmap in your homedir, use the following notation to run it with Genlist: $ export NMAPDIR=$HOME/nmap-VERSION/ $ sudo genlist -s 10.0.0.* --nmap $HOME/nmap-VERISON/ General Options: -v --version Prints the Genlist version number and exits. -h --help Display this information Prints a short help screen with the most common command flags. Running Genlist without any arguments does the same thing. FEATURE REQUESTS
Any feature requests should be reported to the online feature-request-tracking system available on the web at : http://sourceforge.net/tracker/?func=add&group_id=149390&atid=774489 Before requesting a feature, please check to see if the features has already been requested. BUG REPORTS
Any bugs found should be reported to the online bug-tracking system available on the web at : http://sourceforge.net/tracker/?func=add&group_id=149390&atid=774488. Before reporting bugs, please check to see if the bug has already been reported. When reporting PBNJ bugs, it is important to include a reliable way to reproduce the bug, version number of PBNJ and Nmap, OS name and version, and any relevant hardware specs. And of course, patches to rectify the bug are even better. SEE ALSO
scanpbnj(1) outputpbnj(1), nmap(1) AUTHORS
Joshua D. Abraham ( jabra@ccs.neu.edu ) LEGAL NOTICES
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/copyleft/gpl.html, or in the COPYING file included with PBNJ. It should also be noted that PBNJ has occasionally been known to crash poorly written applications, TCP/IP stacks, and even operating systems. While this is extremely rare, it is important to keep in mind. PBNJ should never be run against mission critical systems unless you are prepared to suffer downtime. We acknowledge here that PBNJ may crash your systems or networks and we disclaim all liability for any damage or problems PBNJ could cause. perl v5.8.8 2006-11-06 GENLIST.MAN.1(1p)
All times are GMT -4. The time now is 07:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy