RE: joining word/ lines in a file

2002-05-29 Thread DENNIS WILLIAMS
Suhen - Actually you've hit one of the limitations of the traditional Unix tools such as awk, sed, etc. The perform multi-line changes only with difficulty. Perl is as powerful and easy to use as each of those individually, and offers incredible strengths beyond those. As a bonus, Perl is availabl

RE: joining word/ lines in a file

2002-05-28 Thread Suhen Pather
Thanks Steven, Jared for the ideas. Regards Suhen > -- Suhen Pather <[EMAIL PROTECTED]> > > > Hey this is a not a trick question, without buying the books > > listed below is there a way using the std awk, sed, tr *nix > > utilities. > > Perl is going

RE: joining word/ lines in a file

2002-05-28 Thread Steven Lembark
-- Suhen Pather <[EMAIL PROTECTED]> > Hey this is a not a trick question, without buying the books > listed below is there a way using the std awk, sed, tr *nix > utilities. Perl is going to be the simplest since it has a regex for whitespace and you can easily change the input rec

RE: joining word/ lines in a file

2002-05-28 Thread Suhen Pather
Hey this is a not a trick question, without buying the books listed below is there a way using the std awk, sed, tr *nix utilities. Suhen > Flex, Bison & some programming will probably do the trick. > There is a nice O'Reilly book dealing with Lex & Yacc wnd even > nice

Re: joining word/ lines in a file

2002-05-28 Thread Steven Lembark
-- Jared Still <[EMAIL PROTECTED]> > If isn't perfect. An 'and' at the end of the line will be joined with > the beginning of the next line, which is not right. Don't strip the newlines, replace them with white space: perl -e 'undef $/; ($a=) =~ s/\n+/ /g; print $a' \ [file [fil

Re: joining word/ lines in a file

2002-05-28 Thread Mladen Gogala
Flex, Bison & some programming will probably do the trick. There is a nice O'Reilly book dealing with Lex & Yacc wnd even nicer book dealing with the C programming language. The Good Book is: Brian Kernighan and Dennis Ritchie: The C Programming Language. You should get the King James (ANSII) ed

Re: joining word/ lines in a file

2002-05-28 Thread Jared Still
Here's a perl one liner: perl -ne 'chomp; print; print qq{\n} if /\;$/' file1.txt > newfile.txt If isn't perfect. An 'and' at the end of the line will be joined with the beginning of the next line, which is not right. I use the following two regular expressions to create executable SQL from

Re: joining word/ lines in a file

2002-05-28 Thread Steven Lembark
oops, wrong direction -- you wanted to take out the newlines. use chomp and print the resulting array with $, left at the default value: $ perl -e 'chomp (my @a = <>); print @a' myfile [anotherfile ...]; i.e., read from ARGV, put it all in an array, slice off the input record separators; pri

Re: joining word/ lines in a file

2002-05-28 Thread Steven Lembark
$ perl -e 'print join "\n", <>' myfile; -- Suhen Pather <[EMAIL PROTECTED]> > List, slightly off topic but > > Unix OS > > I need to join lines/ words in a file. > So that it must be in a readable Oracle format. > > They are seperated by a newline. > > Here is a snippet of what the file looks li