[nycbug-talk] Scripting Question

Bob Ippolito bob at redivi.com
Thu Mar 8 11:48:38 EST 2007

On 3/8/07, Kevin Reiter <KReiter at insidefsi.net> wrote:
> All,
> I know this doesn't pertain to *BSD specifically, but I know there are scripting gurus in here that may know how to do this.
> What I'm trying to do is take a file containing a list of numbers, in the form of:
> 1
> 2
> 3
> 4
> 5
> and convert it to a comma-delimited list on a single line (i.e. 1,2,3,4,5) and write that to an existing file on a specific line.
> (For the curious, what I'm trying to accomplish is taking the results of an Nmap scan, grepping the open ports found, and writing those ports to .nessusrc in order to have Nessus only scan the open ports.  I'm using Free 6.2-RELEASE as my platform of choice, and Bash as my shell, FWIW)
> The examples I've found on a few Google searches don't come close enough to provide any clues.

bump:~/tmp bob$ awk 'BEGIN { printf "%s", getline } { printf ",%s", $0
} END { print }' < foo
bump:~/tmp bob$ cat foo


More information about the talk mailing list