What I am doing wrong?
If have a flat file that is | delimited
% cat flatfile.pipe COL1 | someother data|122343221|blahbalhbalh
other times I get flat files that are : delimited
% cat flatfile.colon COL1 : someother data:122343221:blahbalhbalh
so ...
I wrote a perl script that does something like this ...
% cat splitit.pl #!/sur/bin/perl use Getopt::Std; getopts( 'c:' ); while(<>) { chomp; (@columns) = split /$opt_c/; } foreach $col (@columns) { print "[$col]\n"; }
so ... when I do ...
% ./splitit.pl -c':' < flatfile.colons
... it get output ...
[COL1 ] [ someother data] [122343221] [blahbalhbalh]
... which is good. But when I do ...
% ./splitit.pl -c'|' < flatfile.pipes
... I get output ...
[C] [O] [L] [1] [ ] [ ] [ ] [ ] [|] [ ] [s]
... you get the idea I hope because I sure don't! :)
Thanks
Edit ar0n -- fixed formatting
In reply to split $c by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |