Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!claris!sts!roy From: roy@sts.sts.UUCP Newsgroups: comp.sources.wanted Subject: Re: Column shifting Message-ID: <68200003@sts> Date: 19 May 89 17:47:00 GMT References: <68200001@sts> Lines: 31 Nf-ID: #R:sts:68200001:sts:68200003:000:1318 Nf-From: sts.sts.UUCP!roy May 19 10:47:00 1989 /* Written 12:04 pm May 18, 1989 by roy@sts.sts.UUCP in sts:comp.sources.wanted */ /* ---------- "Column shifting" ---------- */ I'm wondering if there's been a program written that takes a file and outputs that same file except with arbitrary columns shifted over. Some examples are: input file is: 0123456789 Move column 7 to column 1: 0712345689 Move column 7 to column 1, column 3 to column 5: 0712453689 Move column 7 to column 1, column 3 to column 8: 0712456839 This sounds a bit like the bubble sort, so I think it probably exists. Just out of curiosity, are there any other algorithms out there? Thanks. /* End of text from sts:comp.sources.wanted */ Somebody just suggested using the "cut" command of SysV as the solution to this. I read the documentation and it looks like it merely deletes certain columns or fields, but does not move them as I wished. Am I wrong about "cut"? Any other ideas? ================================================================== Roy Bixler | UUCP: ...!{claris,sun}!sts!roy | Semiconductor Test Solutions | Internet: sts!roy@Claris.COM | 4101 Burton Dr. | phones: (408) 727-2885 x132 (work)| Santa Clara, CA 95054 | (408) 289-1035 (home)| ==================================================================