Sponsored Content
Top Forums Shell Programming and Scripting print to more than one outfile AWK Post 302381280 by Scott on Thursday 17th of December 2009 04:29:59 PM
Old 12-17-2009
Code:
awk '
  $1 == "yes" { print $2, $4 > "outfile1" }
  $1 == "no" { print $2, $4 > "outfile2" }
' infile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I get awk to print a " in it's print part?

The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }' I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ". Thanks. (2 Replies)
Discussion started by: LordJezo
2 Replies

2. Shell Programming and Scripting

Setting outfile with (brackets)

I have a file that comes in as 20081002_invoices.txt and needs to go out as invoices(20081002).xls When ran this file should have three seperate fields as follows: column1 column2 column3 data1 data2 data3 when i run the script it produces the invoices(20081002).xls but moves... (1 Reply)
Discussion started by: Pablo_beezo
1 Replies

3. Shell Programming and Scripting

How to extract some parts of a file to create some outfile

Hi All, I am very new in programming. I need some help. I have one input file like: Number of disabled taxa: 9 Loading mapping file: ncbi.map Load mapping: taxId2TaxLevel: 469951 --- Subsample reads (20%): 66680 of 334386 Processing: tree-from-summary Running tree-from-summary... (21 Replies)
Discussion started by: iammitra
21 Replies

4. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

5. UNIX for Dummies Questions & Answers

How to outfile contant as an input for a command

I`m having output file which contain following no which changes every time i run script.The number given below are there in file and i have to fatch them from file. 12 15 56 158 365 165 598 568 265 256 258 now i want to use above number from output to input as $j r=`/omp/bin/ICIC... (1 Reply)
Discussion started by: nitin_aaa27
1 Replies

6. Shell Programming and Scripting

Difference of two data files & writing to an outfile.

Hi Everyone, I have two files i.e. one file2 contains today's data and the other file1 contains Yesterday's data. The data in the files contains 226 columns and the data for the coulums separated by a Pipe "|" delimiter. Now, I have 4 Primary keys (coulumns) by which I have to compare file2 and... (10 Replies)
Discussion started by: filter
10 Replies

7. Shell Programming and Scripting

Copying the Header & footer Information to the Outfile.

Hi I am writing a perl script which checks for the specific column values from a file and writes to the OUT file. So the feed file has a header information and footer information. I header information isaround107 lines i.e. Starts with START-OF-FILE ....... so on .... ... (11 Replies)
Discussion started by: filter
11 Replies

8. UNIX for Dummies Questions & Answers

Outfile

Hi guys! So I have a program that allows the user to enter a file, change some characters (for example, a changes to t, etc.) and then save the new file under a new name. However, I need to press carriage return twice for the program to end. I was just wondering if anyone knew of a way for the... (2 Replies)
Discussion started by: PerlNutt
2 Replies

9. UNIX for Dummies Questions & Answers

xls2csv.py won't print to outfile

Hi, I'm trying to use pyExcelerator's module "xls2csv" converter in ubuntu. The following works great, except the standard out is in the terminal. sudo python xls2csv.py test.xls I want the csv delimited output to be redirected to a file. When I enter.... sudo python xls2csv.py test.xls... (5 Replies)
Discussion started by: jdilts
5 Replies

10. UNIX for Beginners Questions & Answers

INTO OUTFILE Error 2

Good day, I am trying to run the following command but it does not seem to work. # mysql -pPassword asteriskcdrdb -s -b -e "select 'Account ID','Destination','Operator','Provider','Date','BillSec','Rate id','Cost' UNION select accountcode,dst,'PBX',route_name,date_format(calldate,'%Y/%c/%e... (8 Replies)
Discussion started by: esgaroth32
8 Replies
GSLP(1) 							    Ghostscript 							   GSLP(1)

NAME
gslp - Format and print text using ghostscript gsbj - Format and print text for BubbleJet printer using ghostscript gsdj - Format and print text for DeskJet printer using ghostscript gsdj500 - Format and print text for DeskJet 500 BubbleJet using ghostscript gslj - Format and print text for LaserJet printer using ghostscript SYNOPSIS
gslp -12BclqRr -b<header> -f<font> -F<hfont> -L<lines> -p<outfile> -T<n> --add-to-space <units> --add-to-width <units> --columns <n> --detect --first-page <n> --kern <file.afm> --last-page <n> --(heading|footing)-(left|center|right) <string> --margin-(top|bot- tom|left|right) <inches> --no-eject-(file|formfeed) --spacing <n> [gs options] [files] gsbj [options] [files] gsdj [options] [files] gsdj500 [options] [files] gslj [options] [files] DESCRIPTION
This utility provides functionality approximately equivalent to the Unix enscript(1) program. It prints plain text files using a single font. It currently handles tabs and formfeeds, but not backspaces. It will line-wrap when using fixed-pitch fonts. It will also do kern- ing and width adjustment. The default device (-sDEVICE=) and resolution (-r) are as follows: gslp epson 180 gsbj bj10e 180 gsdj deskjet 300 gsdj500 djet500 300 gslj laserjet 300 By default the current date is formatted as the center header. OPTIONS
Standard switches implemented: -12BclqRr -b<header> -f<font> -F<hfont> -L<lines> -p<outfile> Sun switches implemented: -T<n> set tab width Switches ignored: -GghKkmow -# -C -d -J -n -P -S -s -t -v Switches added: --add-to-space <units> add the given number of 1/72" units to the width of each space (may be negative) --add-to-width <units> add the given number of 1/72" units to the width of each character (may be negative) --columns <n> print in <n> columns --detect treat the file as PostScript if it starts with %! --first-page <n> start printing at page <n> --kern <file.afm> kern using information from the given .AFM file --last-page <n> stop printing after page <n> --(heading|footing)-(left|center|right) <string> set the heading/footing fields; use -B first to clear --margin-(top|bottom|left|right) <inches> set a margin --no-eject-(file|formfeed) end-of-file/FF only starts a new column, not a new sheet --spacing <n> use double (n=2), triple (n=3), etc. spacing Also, the string %# in a heading or footing is replaced with the page #. SEE ALSO
gs(1) VERSION
This document was last revised for Ghostscript version 9.07. AUTHOR
Artifex Software, Inc. are the primary maintainers of Ghostscript. This manpage by George Ferguson. 9.07 12 February 2013 GSLP(1)
All times are GMT -4. The time now is 04:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy