Sponsored Content
Top Forums Shell Programming and Scripting how to print field n of line m Post 302246240 by Franklin52 on Monday 13th of October 2008 06:30:22 AM
Old 10-13-2008
Code:
awk 'NR==given_line{print $given_field}' given_file

Regards
 

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
print-service(1M)					  System Administration Commands					 print-service(1M)

NAME
print-service - select, report, import, export active print service on a system SYNOPSIS
print-service [-s service [-m] | -q | -e file | -i file] DESCRIPTION
The print-service utility manages print service selection, as well as export and import of basic print queue configuration. Only a user root privileges or with the Printer Management profile can change the active print service or import print queue configuration. OPTIONS
The following options are supported: -s service Select the active print service for on a host. service can be one of lp or cups. -m Migrate print queue configuration during print service selection. -q Report the active print service on a host. -e file Export basic print queue configuration to a file. -i file Import basic print queue configuration from a file. EXAMPLES
Example 1 Selecting a Print Service The following command selects the CUPS print service as the active print service on a host. # print-service -s cups Example 2 Reporting the Active Print Service The following command reports the active print service on a host. # print-service -q Example 3 Exporting a Print Queue Configuration The following command exports the print queue configuration from the active print service. # print-service -e /tmp/queues Example 4 Importing a Print Queue Configuration The following command imports the print queue configuration to the active print service. # print-service -i /tmp/queues EXIT STATUS
0 Successful completion. non-zero An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpcu | +-----------------------------+-----------------------------+ |Interface Stability |Obsolete | +-----------------------------+-----------------------------+ SEE ALSO
intro(1), attributes(5) NOTES
The print queue configuration saved and restored during export, import, and migration is limited to queue name and device name. It is likely that further configuration changes will be required before imported or migrated print queues become usable. SunOS 5.11 18 Mar 2008 print-service(1M)
All times are GMT -4. The time now is 02:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy