Sponsored Content
Top Forums Shell Programming and Scripting To make sure I don't violate rule #7 Post 302227237 by era on Wednesday 20th of August 2008 11:08:04 PM
Old 08-21-2008
Code:
vnix$ column -t <<HERE
> Item Desc Qty Ord Ext Price Required Date Disposition
> PRT KE54900 MAGNETIC BASE PROTRACTOR MI 1.00 EA 194.85 
> PRT AL535244 2-11/16 5MT HS TS 24" DRILL 1.00 EA 610.60 
> NIA 71203 5/8" 4FL HSCO SE 1-5/8LOC 1.00 EA 30.60 
> BFL 10-10176 1-14 4FL H4 HAND TAPER 1.00 EA 54.34 
> VAL 52286 PT542T 10.00 EA 36.50 
> VAL 52332 PT818T 10.00 EA 36.50 
> GEN 88CM TUNGSTEN CARBIDE PT SCRIBER 3.00 EA 22.02 
> MAF 79000002 82DEG HSS CHATTERLESS 1.00 EA 97.66
> HERE
Item  Desc      Qty       Ord      Ext          Price    Required  Date   Disposition
PRT   KE54900   MAGNETIC  BASE     PROTRACTOR   MI       1.00      EA     194.85
PRT   AL535244  2-11/16   5MT      HS           TS       24"       DRILL  1.00         EA     610.60
NIA   71203     5/8"      4FL      HSCO         SE       1-5/8LOC  1.00   EA           30.60
BFL   10-10176  1-14      4FL      H4           HAND     TAPER     1.00   EA           54.34
VAL   52286     PT542T    10.00    EA           36.50
VAL   52332     PT818T    10.00    EA           36.50
GEN   88CM      TUNGSTEN  CARBIDE  PT           SCRIBER  3.00      EA     22.02
MAF   79000002  82DEG     HSS      CHATTERLESS  1.00     EA        97.66

The output is slightly too large for email (80 columns max recommended) but maybe you can take it from there.

Like the computer, we can only guess which fields are "Item" and which are "Desc"; the other parts may not be too hard to fix. If you know how many fields there are supposed to be and which may contain embedded spaces, maybe you can convert the spaces to something else before feeding the text to column, and convert back afterwards. Here's a proof of concept.

Code:
sed -e '1s/Qty Ord/Qty:Ord/' -e '1s/Ext Price/Ext:Price/' -e '1s/Required Date/Required:Date/' \
  -e '2,$s/ /:/g' -e '2,$s/:/ /' -e '2,$s/:\([^:]*\):\(..\):\([^:]*\):\([^:]*\)$/ \1 \2 \3 \4/' file |
column -t | sed 's/:/ /g'


Last edited by era; 08-21-2008 at 12:21 AM.. Reason: Add proof of concept
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

make and clean in a single rule in the makefile.

Hi, This stems from the following thread https://www.unix.com/showthread.php?t=18299 I have a makefile which makes either executables or a shared library. i.e. make -f unix.mak will create the executables and make -f unix.mak libolsv will create the shared library. Since these have to be... (4 Replies)
Discussion started by: vino
4 Replies

2. Linux

Error in issuing a make and make install

Hi, Recently I install a package and try to do a make and make install. However, in the make it gives me below error:- make:Nothing to be done for 'install-exec-am' make:Nothing to be done for 'install-data-am' Can anyone please explain to me what does this mean? I have been trying... (1 Reply)
Discussion started by: ahjiefreak
1 Replies

3. Solaris

Gani Network Driver Won't Install - make: Fatal error: Don't know how to make targ...

I attached a README file that I will refer to. I successfully completed everything in the README file until step 4. # pwd /gani/gani-2.4.4 # ls COPYING Makefile.macros gem.c Makefile Makefile.sparc_gcc gem.h Makefile.amd64_gcc ... (1 Reply)
Discussion started by: Bradj47
1 Replies

4. Post Here to Contact Site Administrators and Moderators

Rule # 8

In light of this board's rule stating "no BSD vs. Linux vs. Windows or similar threads," is the following post legal (can I post it)? Hi. I'm thinking about obtaining a web server for business purposes and I want to learn to administer and maintain the server myself. I need to be able to use... (1 Reply)
Discussion started by: bluegospel
1 Replies

5. Programming

compile fails in linux ... "No rule to make target" ... HELP

hello all, attached you can find a tool (written in C) that i really need to make it compile under linux i am able to compile and run it successfully in mac os x, but in linux the compilation fails the only thing that i did so far is to change the following #include <sys/malloc.h> to... (13 Replies)
Discussion started by: OneDreamCloser
13 Replies

6. UNIX for Dummies Questions & Answers

Difference between configure/make/make install.

Hi, While installation of apache on linux, we perform the below tasks. 1) Untar 2) configure 3) make 4) make install. I wanted to understand the difference and working of configure/make/make install. Can any one help me understanding this? Thanks in advance. (1 Reply)
Discussion started by: praveen_b744
1 Replies

7. Programming

Issue with make, no rule to make target etc.

I have been trying to split up my src directory to clear out files that are not re-compiled very often. Now I have the following setup in my trunk, trunk/bld trunk/src/ trunk/src/src_server trunk/makefile.linux In the make file, I have compile rules SOURCELOC = src # compile src c++... (4 Replies)
Discussion started by: LMHmedchem
4 Replies

8. Programming

Makefile No rule to make target

I am trying to create a makefile to build a program and am getting the following error: make -f tsimplex.mk make: *** No rule to make target `/main/tsimplex_main.cpp', needed by `tsimplex_main.o'. Stop. OPSYS = $(shell uname -s ) TARGET = tsimplex ROOTDIR = ../../.. GTSDIR =... (1 Reply)
Discussion started by: kristinu
1 Replies
SHAPE_BUILD(1)						      General Commands Manual						    SHAPE_BUILD(1)

NAME
shape_build - shapeTools RMS system building and installation SYNOPSIS
shape [all][VERSIONS=<rule>] [variants] [macro settings] shape install[VERSIONS=<rule>] [INSTALLBASE=<path>] [variants] [macro settings] shape clean[<macro settings>] shape cleancache [<macro settings>] make [all][<macro settings>] make install[INSTALLBASE=<path>] [<macro settings>] make clean[<macro settings>] DESCRIPTION
Shape all, or just shape (as all is the default target), builds the current system node. It performs all necessary actions to derive the main target ($(TARGET) in the Makefile) from the node's source components. Shape all also builds all subsystems of the current node. Before triggering any build action itself, if recursively calls shape for each subsystem. Version selection is driven by the rule given as value to the VERSIONS macro, default is most_recent. The given version selection rule on the command line, if any, is inherited to the recursive calls. Shape install installs the build results of the current node in the appropriate locations. Things to be installed are usually binaries and manuals. The target installtargets in the Makefile lists all these things as its dependents. Shape install updates all build results in the same way as shape all does, before installing them. Shape install invokes all subsystems of the current node in the installation procedure by recursively calling shape install for each of them. This is done, before it performs any build or install actions itself. The appropri- ate versions are selected according to the given version selection rule named in the VERSIONS macro. The default rule for shape install is recent_release selecting the most recent release or prerelease (whichever is newer). The macro INSTALLBASE defines the installation base directory, an absolute pathname pointing to the root of a directory tree, where the build results are to be copied to. Check the Makefile for the default setting of INSTALLBASE and the installation directories defined as relative pathnames starting from the installation base directory. Values of the VERSION and the INSTALLBASE macro set on the command line are inherited to all recursive calls. Shape clean removes all derived objects currently established as UNIX files. These are the files listed in the OBJECTS macro in the Make- file, the derived target ($(TARGET)), and the target aliases ($(ALIASES)). The derived objects, established as UNIX files are those being produced from their source or reinstalled from the derived object cache during the last system build. Shape cleancache cleans up the derived object cache, will say, it removes all objects stored there. All names listed as dependents of the .BPOOL special macro in the Shapefile are candidates to be cached. When multiple (different) versions of derived objects with the same name arise, the older ones are stored to the derived object cache. Shape cleancache in conjunction with shape clean removes all derived (automatically reproducible) objects. The two cleanup actions are not called recursively. They apply only to the current node. The build and cleanup actions (all, install and clean) of the shape RMS can be performed by make(1) and by shape(1). The main difference is, that shape is capable of setting up the appropriate source context according to a given version selection rule, while make only regards the regular UNIX files. Make will fail if not every component of the system has a checked out busy version. The intention for maintaining Makefiles suitable for complete system builds aims at system building and installation from a source distribution rather than from the development area. Source distributions are system copies taken from one of the release trees (partial release area or release area). See shape_RMS(1) for details. Make all, make install and make clean behave similar to their shape counterparts. The difference is, that they expect a complete system source context to be set up as UNIX files (see above). Each macro definition in the Make- or Shapefile may be redefined from the command line. Most of the shape RMS standard macro definitions are inherited to recursive calls of make or shape. Check the shape_tmpl(7) manual page for a list of the standard macros. INCONVENIENCES
For technical reasons, each make call recursively invokes make on the same level before performing any actions. This unfortunately restricts the efficacy of command line options. E.g. there is no chance to work with the -f (alternate name for the Makefile) option and the redefinition of macros is restricted to inherited ones. This restriction does not apply to shape calls. FILES
Makefile Shapefile SEE ALSO
shape_stdrul(7), shape_tmpl(7) 9.9.119 SHAPE_BUILD(1)
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy