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 to be the
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
$ 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 like.
FILE1
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;
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
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)
-- 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=ARGV) =~ s/\n+/ /g; print $a' \
[file
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
nicer
-- 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 record