[nycbug-talk] Scripting Question

Kevin Reiter KReiter at insidefsi.net
Thu Mar 8 11:13:33 EST 2007


-----Original Message-----
From: Ray Lai [mailto:ray at cyth.net]
Sent: Thursday, March 08, 2007 11:07 AM
To: Kevin Reiter
Subject: Re: [nycbug-talk] Scripting Question


On Thu, Mar 08, 2007 at 11:00:20AM -0500, Ray Lai wrote:
> On Thu, Mar 08, 2007 at 10:44:19AM -0500, Kevin Reiter 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.
> 
> $ jot -s, 5

Oops, should have read more carefully.  Try:

$ tr '\n' , < file.in | sed 's/,$//' > file.out

The bit about a specific line is more difficult, though you could
probably use a combination of head(1) and tail(1).

Or just use Perl.

-Ray-

I don't know how to do "Hello World!" in Perl, let alone trying to figure this out with it :)

The second example worked like a charm:

tr '\n' , < host-ports | sed 's/,$//' > $port_temp

That did the trick, aside from rewriting the line in .nessusrc with the output, which I can I can do in a minute or two..

Thanks!


This message may contain confidential or proprietary information and is intended solely for the individual(s) to whom it is addressed.  If you are not a named addressee you should not disseminate, distribute or copy this e-mail or act upon the information contained herein.  Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.




More information about the talk mailing list