On Mon, 5 Sep 2022 16:25:20 -0700, Retired Mainframer wrote: >"It didn't work" doesn't tell us very much. How did the results differ from >what you wanted? > >Is it always four blanks in field 1, two in field 2, two in field 3, and 2 in >field 4? Is the length of each field constant across all the records? If so, >then does > BUILD=(5,8,15,5,22,21,45,5) >come close to what you want? > Here's an alternative sample using "sed"; independent of number of fields or number of leading spaces: #! /bin/sh -x
echo "\ ll 1652087| 0049| OPTICAL | 0170| ll 2130994| 0006| STATIONERY | 0716| ll 2199447| 0078| SERVE OVER PIZZA | 0410| ll 2199449| 0078| SERVE OVER PIZZA | 0410|" | sed ' # Special treatment for first field -- remove length s/^.. *// # Remaining fields s/| */|/g' It's not what the oP asked for, but Mr. Natural says, Use the right tool for the job. BTW, what's the syntax for comments in DFSORT command files? The solution above, lacking comments and with 8 numeric positional parameters is horribly opaque to the novice. >-----Original Message----- >From: Ron Thomas >Sent: Monday, September 5, 2022 10:31 AM > >We have a input PIPE DELIMITED file as follows of lrecl = 80. Need to remove >the leading spaces with out disturbing the 3 column values > >....1652087|..0049|..OPTICAL |..0170| >....2130994|..0006|..STATIONERY |..0716| >....2199447|..0078|..SERVE OVER PIZZA |..0410| >....2199449|..0078|..SERVE OVER PIZZA |..0410| > >o/p has to be > >1652087|0049|OPTICAL |0170| >2130994|0006|STATIONERY |0716| >2199447|0078|SERVE OVER PIZZA |0410| >2199449|0078|SERVE OVER PIZZA |0410| -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN