Perhaps a starting point:
Or, you you want to remove also the extra spaces:$ echo ' | | | SNDYN000036000 | Unloadable | The SKU is not valid for +the | | | | | | vendor with vendor number | | | | | | 875323. | ' | +perl -pe 's/\|//g;' SNDYN000036000 Unloadable The SKU is not valid for the ven +dor with vendor number 875323.
Update: I had not seen your new post with the formatted data when I wrote my post. Obviously, a bit more is required, though possibly not so much:$ echo ' | | | SNDYN000036000 | Unloadable | The SKU is not valid for +the | | | | | | vendor with vendor number | | | | | | 875323. | ' | +perl -pe 's/\|//g; s/\s+/ /g;' SNDYN000036000 Unloadable The SKU is not valid for the vendor with ve +ndor number 875323.
In brief, you have to tell what to do with the column headers, dashes, etc., and we can get pretty close to your needs. For example, something m perhaps closer to your needs:$ echo '-------------------------------------------------------------- +---------------------- > | Vendor | Vendor | Sku Number | Status | Status Detail + | > | ID | Name | | | + | > -------------------------------------------------------------------- +---------------- > | | | SNDYN000036000 | Unloadable | The SKU is not v +alid for the | > | | | | | vendor with vend +or number | > | | | | | 875323. + |' | perl -pe 's/\|//g; s/\s+/ /g;' ---------------------------------------------------------------------- +-------------- Vendor Vendor Sku Number Status Status Detail ID Nam +e ------------------------------------------------------------------- +----------------- SNDYN000036000 Unloadable The SKU is not valid for + the vendor with vendor number 875323.
$ echo '-------------------------------------------------------------- +---------------------- > | Vendor | Vendor | Sku Number | Status | Status Detail + | > | ID | Name | | | + | > -------------------------------------------------------------------- +---------------- > | | | SNDYN000036000 | Unloadable | The SKU is not v +alid for the | > | | | | | vendor with vend +or number | > | | | | | 875323. + | > ' | perl -ne 'next if /^\s*-/; s/\|//g; s/\s+/ /g; print;' Vendor Vendor Sku Number Status Status Detail ID Name SNDYN00003600 +0 Unloadable The SKU is not valid for the vendor with vendor number + 875323.
In reply to Re: tricky text file
by Laurent_R
in thread tricky text file
by raidermike
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |