|
-
i would do it in perl (as i know it better than awk/sed)
just read every line of the file
split it up based on the space
print out each individual line with single quotes around it.
something like
<font face="courier">
#!/usr/bin/perl
open (FILE, "/your/file");
while (<FILE>) {
chomp; # gets rid of newline character
($f1,$f2,$f3,$f4,$f5) = split ' ', $_;
print "'$f1' '$f2' '$f3' '$f4' '$f5'\n";
}
</font>
that would print everything to the screen and you could redirect it to a file, or you could just open another file in the program and print it there.
that one works (or might not since it's off the top of my head) only when there are 5 fields, you could do it with a variable number of fields by using some regular expressions but i figured the above way was easiest to understand.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|