Sponsored Content
Full Discussion: Chemist Needs Help
Top Forums UNIX for Dummies Questions & Answers Chemist Needs Help Post 302251953 by jim mcnamara on Tuesday 28th of October 2008 12:15:20 PM
Old 10-28-2008
I think you probably have Bourne shell - lets' try this (changes in red)
Code:
#!/bin/sh
# FILE: chem.awk  requires execute permission
# usage: ./chem.awk infile infile2 infile3 outfile

# where parms are:
#   $1 = infile1  $2 = infile2   $3 = infile3  $4 = outfile
# do not forget to change "comment" to something menaingful if needed
echo "
parameters
$1
$2
$3
$4"


# start the FILE
printf "%s\n%s\n%s\n%s\n" "comment" "x y x" "101" "4 7" > ./newfile

# read in two constants
awk '/Done/ {print $5; exit}' "$1" | read col3
awk '/Done/ {print $5; exit}' "$2" | read col4
export col3
export col4

# loop thru the big input FILE writing 101 rows
awk '/Done/ {print $5}' "$3" | \
awk -v col4="$col4" -v col3="$col3" ' BEGIN { cnt =1.5 }
              {printf("%.1f %s %s %s\n", cnt, $0, col3, col4) 
              cnt+=.1 }'>> ./newfile
# rename the output FILE to what was required
mv ./newfile "$4"            
echo "lines in outputfile: $(wc -l "$4") created"
exit 0
# EOF: chem.awk

 

We Also Found This Discussion For You

1. UNIX for Dummies Questions & Answers

Chemist Needs Help part II

Hello friends, I was wondering if you can help me with probably a simple function to you all: the sample looks and has this format. I was wondering how I could extract the first and second column starting including the line 'E/N and Ko' and not stop until there are no more lines. Thank you for... (5 Replies)
Discussion started by: gingburg
5 Replies
SVN-DO(1)							 Command reference							 SVN-DO(1)

NAME
svn-do - export a source and run a command inside the source. SYNOPSIS
svn-do COMMAND DESCRIPTION
svn-do will use svn-buildpackage to export a source, run a command inside the exported source and, if the command succeeds, copy back the debian/ tree EXAMPLES
clean the tree (useful if this requires the full source tree) $ svn-do debclean I: Exporting source tree via svn-buildpackage... [...] I: Running command: debclean [...] I: Copying back the debian/ tree... 'debian/control' -> 'path/package/debian/control' use quilt to refresh a patch $ QUILT_PATCHES=debian/patches svn-do sh -c "quilt push 002_static-linking-dont-build-perf.patch; quilt refresh" [...] I: Copying back the debian/ tree... [...] 'debian/patches/002_static-linking-dont-build-perf.patch' -> '/path/package/debian/patches/002_static-linking-dont-build-perf.patch' Start a source editing session and decide later not to copy back the debian/ tree $ svn-do $SHELL [...] I: Running command: /bin/zsh % exit 1 E: command exited with 1; not copying back the debian/ tree. edit a patch in a CDBS' simple-patchsys based package $ svn-do cdbs-edit-patch 02_pmount.patch [...] SEE ALSO
/usr/share/doc/svn-buildpackage/() The svn-buildpackage HOWTO manual svn-inject(1) puts a Debian source package into Subversion repository svn-upgrade(1) upgrade source package from a new upstream revision svn(1) Subversion command line client tool dpkg-buildpackage(1) Debian source package tools lintian(1) Debian package checker AUTHORS
Eduard Bloch This manual page was written by Eduard Bloch in roff. Goneri Le Bouder Converted manpages to SGML. Neil Williams Converted manpages to DocBook XML and current Debian maintainer COPYRIGHT
Copyright (C) 2009 Eduard Bloch Release: 0.8.2 May 2009 SVN-DO(1)
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy