Sponsored Content
Top Forums Shell Programming and Scripting Supressing and replacing the output of a field in Awk Post 302278868 by zaxxon on Wednesday 21st of January 2009 10:34:53 AM
Old 01-21-2009
Not sure if it is what yo want:

Code:
awk 'NR > 1 && /linger/ {sub(/\(linger: 1800\)/,"ChangeBase"); print; next} NR > 1 {print $0,"CMBase"; next} {print}' infile
User Process ID Time Active Licences Type
ChangeAdmin (Phys-agsdev/19353 212), start Wed 1/21 6:30 ChangeBase
u414013 (Phys-agsdev/19353 1491), start Wed 1/21 12:54 ChangeBase
z001429 (Phys-agsdev/19353 788), start Wed 1/21 13:03 ChangeBase
u414014 (Phys-agsdev/19353 1009), start Wed 1/21 10:34 CMBase
z311203 (Phys-agsdev/19353 2368), start Wed 1/21 10:52 CMBase
u414020 (Phys-agsdev/19353 879), start Wed 1/21 11:43 CMBase
z311260 (Phys-agsdev/19353 1523), start Wed 1/21 12:17 CMBase
oracled (Phys-agsdev/19353 555), start Wed 1/21 9:00 CMBase
u414013 (Phys-agsdev/19353 1717), start Wed 1/21 12:56  CMBase

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to include field in the output filename of awk

Im using awk and I want the output filename to contain the first field of the input file. Ex. 1 dddd wwwww 1 eeeee wwww 1 wwww eerrrr 2 eeee eeeeee I want the output files to be xxx1 and xxx2 Thank you (4 Replies)
Discussion started by: yahyaaa
4 Replies

2. Shell Programming and Scripting

Help supressing spool output from screen when calling sqlplus from script

I'm calling an embedded sql from my shell script file. This sql does simple task of spooling out the contents of the table (see below my sample code) into a spool file that I specify. So far so good, but the problem is that the output is also displayed on screen which I do NOT want. How can I... (3 Replies)
Discussion started by: MxC
3 Replies

3. Shell Programming and Scripting

Help with Awk finding and replacing a field based on a condition

Hi everybody, I'm trying to replace the $98 field with "T" if the last field (108th) is T I've tried awk 'BEGIN{OFS=FS="|"} {if ($108=="T")sub($98,"T"); print}' test.txt but that doesn't do anything also tried awk 'BEGIN{OFS=FS="|"}{ /*T.$/ sub($98,"T")} { print}' test.txt but... (2 Replies)
Discussion started by: jghi123
2 Replies

4. Shell Programming and Scripting

awk output field delimiter

Dear All, 1.txt (tab in between each value in a line) a b c a b c a c d you can see below, why with ~ i can output with tab, but = cannot? # awk -F'\t' '$2 ~ /b/' 1 a b c a b c # awk -F'\t' '$2 = "b"' 1 a b c a b c a b d ... (1 Reply)
Discussion started by: jimmy_y
1 Replies

5. Shell Programming and Scripting

Compare two files and output difference, by first field using awk.

It seems like a common task, but I haven't been able to find the solution. vitallog.txt 1310,John,Hancock 13211,Steven,Mills 122,Jane,Doe 138,Thoms,Doe 1500,Micheal,May vitalinfo.txt 12122,Jane,Thomas 122,Janes,Does 123,Paul,Kite **OUTPUT** vitalfiltered.txt 12122,Jane,Thomas... (2 Replies)
Discussion started by: charles33
2 Replies

6. UNIX for Dummies Questions & Answers

awk - output field separator

In awk, how do I print all fields with a specified output field separator? I have tried the following, which does not print the output FS: echo a b c d | awk 'BEGIN{OFS = ";"}{print $0}' (3 Replies)
Discussion started by: locoroco
3 Replies

7. UNIX for Dummies Questions & Answers

awk truncating first field output?

Hello, I'm writing an Awk script to take a command line argument (student's name) and output their relevant student#, name, and marks. For some reason, awk arbitrarily removes the first digit from the student number and doesn't show me the proper output. Here is my code: #! /usr/bin/awk -f... (6 Replies)
Discussion started by: trashmouth12
6 Replies

8. Shell Programming and Scripting

awk calculation wrong field output

The awk below is close but I can't seem to fix it to produce the desired output. Thank you :). current awk with output awk '{c1++; c2+=($2)} END{for (e in c1) print e, c1, c2}' input EFCAB5 2 50 USH2A 2 19 desired... (8 Replies)
Discussion started by: cmccabe
8 Replies

9. Shell Programming and Scripting

awk to print field from lookup file in output

The below awk uses $3 and $4 in search as the min and max, then takes each $2 value in lookup and compares it. If the value in lookupfalls within the range in searchthen it prints the entire line in lookup/ICODE]. What I can't seem to figure out is how to print the matching $5 from search on that... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. Shell Programming and Scripting

Using awk to print output based on first field.

Hi Folks, I have one requirement, There is one file, which contains two fields. Based on first field, I need to print an output. Example will be more suitable. Input file like this. abc 5 abc 10 xyz 6 xyz 9 xyz 10 mnp 10 mnp 12 mnp 6 (2 Replies)
Discussion started by: Raza Ali
2 Replies
CTIE(1) 						      General Commands Manual							   CTIE(1)

NAME
ctie - merge or apply CWEB change files SYNOPSIS
ctie -c|-m outputfile masterfile changefile... DESCRIPTION
The ctie program is used to process multiple change files used with the CWEB system for literate programming. The CWEB programs allow one to apply patches to a source file (the masterfile) by means of a single change file. ctie can be used to either merge up to 32 change files into a single one or to apply the changes to the masterfile in order to create a new master file. Output of either the new change file or the patched master file goes into outputfile. Any include files (indicated using the CWEB @i command) are fully expanded during ctie processing, which means that the change files are able to modify the contents of any included files. OPTIONS
-c Create a single change file from the given changefiles. -m Create a new master file by applying the given changefiles. ENVIRONMENT
The environment variable CWEBINPUTS is used to search for the input files, or the system default if CWEBINPUTS is not set. See tex(1) for the details of the searching. SEE ALSO
cweb(1), ctiedoc.tex, tie(1), web(1). AUTHOR
Julian Gilbey, jdg@debian.org. The original TIE program was by Klaus Guntermann, TH Darmstadt, Institut f. Theoretische Informatik. The TIE man page was by Joachim Schnitter, TH Darmstadt, Phys. Chemie I, and was modified for CTIE by Julian Gilbey. Web2C 2012 7 April 2010 CTIE(1)
All times are GMT -4. The time now is 10:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy