Sponsored Content
Full Discussion: awk
Top Forums UNIX for Dummies Questions & Answers awk Post 55551 by jim mcnamara on Tuesday 14th of September 2004 02:55:47 PM
Old 09-14-2004
try:
Code:
RESPOND="some thing"
awk -v respond=$RESPOND -F" " '$1 == respond { print $0}' txt.tmp

 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

3. Shell Programming and Scripting

awk: assign variable with -v didn't work in awk filter

I want to filter 2nd column = 2 using awk $ cat t 1 2 2 4 $ VAR=2 #variable worked in print $ cat t | awk -v ID=$VAR ' { print ID}' 2 2 # but variable didn't work in awk filter $ cat t | awk -v ID=$VAR '$2~/ID/ { print $0}' (2 Replies)
Discussion started by: honglus
2 Replies

4. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

5. Shell Programming and Scripting

Comparison and editing of files using awk.(And also a possible bug in awk for loop?)

I have two files which I would like to compare and then manipulate in a way. File1: pictures.txt 1.1 1.3 dance.txt 1.2 1.4 treehouse.txt 1.3 1.5 File2: pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244 dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2... (1 Reply)
Discussion started by: linuxkid
1 Replies

6. Shell Programming and Scripting

awk command to compare a file with set of files in a directory using 'awk'

Hi, I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files. To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Discussion started by: anandek
10 Replies

7. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

8. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

9. Shell Programming and Scripting

Pass awk field to a command line executed within awk

Hi, I am trying to pass awk field to a command line executed within awk (need to convert a timestamp into formatted date). All my attempts failed this far. Here's an example. It works fine with timestamp hard-codded into the command echo "1381653229 something" |awk 'BEGIN{cmd="date -d... (4 Replies)
Discussion started by: tuxer
4 Replies

10. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies
backend(7)							    Apple Inc.								backend(7)

NAME
backend - cups backend transmission interfaces SYNOPSIS
backend backend job user title num-copies options [ filename ] DESCRIPTION
Backends are a special type of filter(7) which is used to send print data to and discover different devices on the system. Like filters, backends must be capable of reading from a filename on the command-line or from the standard input, copying the standard input to a temporary file as required by the physical interface. The command name (argv[0]) is set to the device URI of the destination printer. Starting with CUPS 1.1.22, any authentication information in argv[0] is removed, so backend developers are urged to use the DEVICE_URI environment variable whenever authentication information is required. The CUPS API includes a cupsBackendDeviceURI function for retrieving the correct device URI. Back-channel data from the device should be relayed to the job filters by writing to file descriptor 3. The CUPS API includes the cups- BackChannelWrite function for this purpose. DEVICE DISCOVERY
When run with no arguments, the backend should list the devices and schemes it supports or is advertising to stdout. The output consists of zero or more lines consisting of any of the following forms: device-class scheme "Unknown" "device-info" device-class device-uri "device-make-and-model" "device-info" device-class device-uri "device-make-and-model" "device-info" "device-id" device-class device-uri "device-make-and-model" "device-info" "device-id" "device-location" The device-class field is one of the following values: direct The device-uri refers to a specific direct-access device with no options, such as a parallel, USB, or SCSI device. file The device-uri refers to a file on disk. network The device-uri refers to a networked device and conforms to the general form for network URIs. serial The device-uri refers to a serial device with configurable baud rate and other options. If the device-uri contains a baud value, it represents the maximum baud rate supported by the device. The scheme field provides the URI scheme that is supported by the backend. Backends should use this form only when the backend supports any URI using that scheme. The device-uri field specifies the full URI to use when communicating with the device. The device-make-and-model field specifies the make and model of the device, e.g. "Acme Foojet 2000". If the make and model is not known, you must report "Unknown". The device-info field specifies additional information about the device. Typically this includes the make and model along with the port number or network address, e.g. "Acme Foojet 2000 USB #1". The optional device-id field specifies the IEEE-1284 device ID string for the device, which is used to select a matching driver. The optional device-location field specifies the physical location of the device, which is often used to pre-populate the printer-location attribute when adding a printer. PERMISSIONS
Backends without world execute permissions are run as the root user. Otherwise, the backend is run using the unprivileged user account, typically "lp". EXIT CODES
The following exit codes are defined for backends; C API constants defined in the <cups/backend.h> header file are defined in parenthesis: 0 (CUPS_BACKEND_OK) The print file was successfully transmitted to the device or remote server. 1 (CUPS_BACKEND_FAILED) The print file was not successfully transmitted to the device or remote server. The scheduler will respond to this by canceling the job, retrying the job, or stopping the queue depending on the state of the error-policy attribute. 2 (CUPS_BACKEND_AUTH_REQUIRED) The print file was not successfully transmitted because valid authentication information is required. The scheduler will respond to this by holding the job and adding the authentication-required job-reasons keyword. 3 (CUPS_BACKEND_HOLD) The print file was not successfully transmitted because it cannot be printed at this time. The scheduler will respond to this by hold- ing the job. 4 (CUPS_BACKEND_STOP) The print file was not successfully transmitted because it cannot be printed at this time. The scheduler will respond to this by stop- ping the queue. 5 (CUPS_BACKEND_CANCEL) The print file was not successfully transmitted because one or more attributes are not supported. The scheduler will respond to this by canceling the job. 6 (CUPS_BACKEND_RETRY) The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job at a future time - other jobs may print before this one. 7 (CUPS_BACKEND_RETRY_CURRENT) The print file was not successfully transmitted because of a temporary issue. The scheduler will retry the job immediately without allowing intervening jobs. All other exit code values are reserved. SEE ALSO
cupsd(8), cupsd.conf(5), filter(7), http://localhost:631/help COPYRIGHT
Copyright 2007-2011 by Apple Inc. 15 April 2011 CUPS backend(7)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy