Sponsored Content
Top Forums Shell Programming and Scripting how to print field n of line m Post 302276541 by Deanne on Wednesday 14th of January 2009 04:13:33 AM
Old 01-14-2009
Hmmm, can someone help me why it doesnt work when i use a variable for the "given_line", eg:

awk 'NR==$counter{print $25}' $argv[1]

thanks in advance!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print empty line when the a field is changed

Hi all, I have this input file .. BSS01 107 Swafieh 11/06/2008 12:06:57 BSS01 111 Ramada_Hotel 12/06/2008 11:37:20 BSS01 147 Kalha_Rep 11/06/2008 19:13:39 BSS01 147 Kalha_Rep ... (9 Replies)
Discussion started by: yahyaaa
9 Replies

2. Shell Programming and Scripting

Print line if first Field matches a pattern

Hi All, I would like my code to be able to print out the whole line if 1st field has a dot in the number. Sample input and expected output given below. My AWK code is below but it can;t work, can any expert help me ? Thanks in advance. {if ($1 ~ /*\.*/) { print $0 }} Input: ... (2 Replies)
Discussion started by: Raynon
2 Replies

3. Shell Programming and Scripting

Print the entire line if second field has value P

Friends, I have .txt file with 3 millions of rows. File1.txt ABC1|A|ABCD1|XYZ1 ABC2|P|ABCD2|XYZ2 ABC3|A|ABCD3|XYZ3 ABC4|P|ABCD4|XYZ4 If second field has value P then print the entire line. Thanks in advance for your help, Prashant (4 Replies)
Discussion started by: ppat7046
4 Replies

4. Shell Programming and Scripting

How to print line if field matches?

Hi all, I got several lines line this a b c d e 1 e a 1 c d e 3 f a b c 1 e 8 h a b c d e 1 w a 1 c d e 2 w a b c d e 1 t a b c d e 7 4 How can I print the line if 1 is the field one before the last field? Basicly this 2 field ? a b c d e 1 e a b c d e 1 t The file I got is... (7 Replies)
Discussion started by: stinkefisch
7 Replies

5. UNIX for Advanced & Expert Users

print line backwards - horizontally by field?

let's say you have dog, cat, 1, 2, 3 reverse, 7, 9, i, tell, you you want to print 3, 2, 1, cat, dog you, tell, i, 9, 7, reverse The delimiter is a comma. The number of commas in each line though is undetermined. How would you do this using either regular UNIX or awk? I know the... (5 Replies)
Discussion started by: Josef_Stalin
5 Replies

6. Shell Programming and Scripting

only print line if 3rd field is 01

Similar question... I have a space delimited text file and I want to only print the lines where the 3rd word/field/column is equal to "01" awk '{if $3 = "01" print $0}' something like this. I meant to say: only print line IF 3rd field is 01 (2 Replies)
Discussion started by: ajp7701
2 Replies

7. Shell Programming and Scripting

Print a field from the previous line

plz help me!! I have this file , 3408 5600 3796 6035 4200 6285 4676 0 40 1554 200 1998 652 2451 864 2728 1200 0 I want it like if $2==0,replace it with field from the previous line+500 say here the o/p would be like 3408 5600 3796 6035 4200 6285... (16 Replies)
Discussion started by: Indra2011
16 Replies

8. Shell Programming and Scripting

print whole line if the 1st field contains...

i want to print lines in a file that the 1st field of each line has a Date shape such: yy/mm/dd or on the other hand contains slash "/" . (1 Reply)
Discussion started by: oreka18
1 Replies

9. Shell Programming and Scripting

Use two field separator in the same line and print them

Hi Guys, I have the file --- HOST_NAME,data_coleta,data_carga,CPU_util,CPU_idle,run_queue,memory,MEMORY_SYSTEM,MEMORY_TOTAL,MEMORY_SWAPIN,MEMORY_SWAPOUT,DISK_READ,DISK_WRITE,DISK_IO,NET_IN_PACKET, NET_OUT_PACKET... (4 Replies)
Discussion started by: antoniorajr
4 Replies

10. Shell Programming and Scripting

Command/script to match a field and print the next field of each line in a file.

Hello, I have a text file in the below format: Source Destination State Lag Status CQA02W2K12pl:D:\CAQA ... (10 Replies)
Discussion started by: pocodot
10 Replies
SMBSPOOL(8)						    System Administration tools 					       SMBSPOOL(8)

NAME
smbspool - send a print file to an SMB printer SYNOPSIS
smbspool {job} {user} {title} {copies} {options} [filename] DESCRIPTION
This tool is part of the samba(7) suite. smbspool is a very small print spooling program that sends a print file to an SMB printer. The command-line arguments are position-dependent for compatibility with the Common UNIX Printing System, but you can use smbspool with any printing system or from a program or script. DEVICE URI smbspool specifies the destination using a Uniform Resource Identifier ("URI") with a method of "smb". This string can take a number of forms: o smb://server[:port]/printer o smb://workgroup/server[:port]/printer o smb://username:password@server[:port]/printer o smb://username:password@workgroup/server[:port]/printer smbspool tries to get the URI from the environment variable DEVICE_URI. If DEVICE_URI is not present, smbspool will use argv[0] if that starts with "smb://" or argv[1] if that is not the case. Programs using the exec(2) functions can pass the URI in argv[0], while shell scripts must set the DEVICE_URI environment variable prior to running smbspool. OPTIONS
o The job argument (argv[1]) contains the job ID number and is presently not used by smbspool. o The user argument (argv[2]) contains the print user's name and is presently not used by smbspool. o The title argument (argv[3]) contains the job title string and is passed as the remote file name when sending the print job. o The copies argument (argv[4]) contains the number of copies to be printed of the named file. If no filename is provided then this argument is not used by smbspool. o The options argument (argv[5]) contains the print options in a single string and is currently not used by smbspool. o The filename argument (argv[6]) contains the name of the file to print. If this argument is not specified then the print file is read from the standard input. VERSION
This man page is correct for version 3 of the Samba suite. SEE ALSO
smbd(8) and samba(7). AUTHOR
smbspool was written by Michael Sweet at Easy Software Products. The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed. The original Samba man pages were written by Karl Auer. The man page sources were converted to YODL format (another excellent piece of Open Source software, available at ftp://ftp.icce.rug.nl/pub/unix/) and updated for the Samba 2.0 release by Jeremy Allison. The conversion to DocBook for Samba 2.2 was done by Gerald Carter. The conversion to DocBook XML 4.2 for Samba 3.0 was done by Alexander Bokovoy. Samba 3.5 06/18/2010 SMBSPOOL(8)
All times are GMT -4. The time now is 03:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy