Sponsored Content
Top Forums Shell Programming and Scripting displaying multiple lines using AWk Post 302465645 by Scott on Saturday 23rd of October 2010 05:37:19 AM
Old 10-23-2010
Hi.

You can use something like NR>=534 && NR<=537 (NR>533 && NR<538)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk Join multiple lines

Hi, I have data with broken lines: Sample data: "12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50" "16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|" 2453748"|"08:15:50" "16"|"25"|"a"|"b"|" c"|"d"|"e"|"f"|"2453748"|"08:19:50" "16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50" In the... (5 Replies)
Discussion started by: hitmansilentass
5 Replies

2. UNIX for Dummies Questions & Answers

print multiple lines with awk

Hi everyone! I'm not new to Unix, but I've never used awk before. I tried to look up this information on several sites and forums, I also looked in the documentation but I haven't found a solution yet. I would like to print the previous 3 lines before and the following 4 lines after the... (6 Replies)
Discussion started by: djcsabus
6 Replies

3. Shell Programming and Scripting

Awk to Break lines to multiple lines.

Input File: nawk -F "|" '{ for(i=1;i<=NF;i++) { if (i == 2) {gsub(",","#",$i);z=split($i,a,"")} else if (i == 3) {gsub(",","#",$i);z=split($i,b,"")} } if(z > 0) for(i=1;i<=z;i++) print $1,a,"Test"; if(w > 0) for(j=1;j<=w;j++) ... (1 Reply)
Discussion started by: pinnacle
1 Replies

4. Shell Programming and Scripting

AWK record in multiple lines

Hi everyboby this is my problem I Have this input 1111;222 222 2;333 3333;4444 111; 22222;33 33; 444 and I need this output 1111;2222222;3333333;4444 (15 Replies)
Discussion started by: agritur
15 Replies

5. Shell Programming and Scripting

inserting multiple lines with awk

awk '/<login-module code="com.nlayers.seneca.security.LdapLogin" flag="sufficient">/{p++} /<login-module code="com.nlayers.seneca.security.LdapLogin" flag="sufficient">/ && p==1 {$0="Mulitple lines here\n"$0}1' login-config.xml In the above awk code inside shell script, i am having problems when... (1 Reply)
Discussion started by: sunrexstar
1 Replies

6. Shell Programming and Scripting

Awk match multiple columns in multiple lines in single file

Hi, Input 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr21.fa chr3.fa 7488 7389 chr1.fa chr1.fa 3546 9887 chr9.fa chr5.fa 7898 7387 chrX.fa chr3.fa Desired Output 7488 7389 chr1.fa chr1.fa 2 3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

7. Shell Programming and Scripting

awk to filter multiple lines

Hi. I need to filter lines based upon matches in multiple tab-separated columns. For all matching occurrences in column 1, check the corresponding column 4. IF all column 4 entries are identical, discard all lines. If even one entry in column 4 is different, then keep all lines. How can I... (5 Replies)
Discussion started by: owwow14
5 Replies

8. Shell Programming and Scripting

awk to parse multiple lines

What is the correct syntax to have the awk parse the next line as well? The next in bold is where I think it should go, but I wanted to ask the experts since I am a beginner. The file to be parsed is attached as well. Thank you :). awk 'NR==2 {split($2,a,"");b=substr(a,1,length(a-1));print... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. Shell Programming and Scripting

Merging multiple lines to columns with awk, while inserting commas for missing lines

Hello all, I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person. In the csv, a person may be listed from one to four times... (9 Replies)
Discussion started by: RalphNY
9 Replies

10. UNIX for Advanced & Expert Users

awk multiple lines

When your data is consistent it is easy to use awk with multiple lines like this. Can we please make this portable so I can use this in both RHEL and AIX? awk '{RS="/directory1" } $7 ~ /drwxr-xr-x/ {print $1 " " $7}' file What do I do when the data is not consistent? When your data is not... (2 Replies)
Discussion started by: cokedude
2 Replies
FS_GETSERVERPREFS(1)					       AFS Command Reference					      FS_GETSERVERPREFS(1)

NAME
fs_getserverprefs - Displays preference ranks for file servers or VL servers SYNOPSIS
fs getserverprefs [-file <output to named file>] [-numeric] [-vlservers] [-help] fs gets [-f <output to named file>] [-n] [-v] [-h] fs gp [-f <output to named file>] [-n] [-v] [-h] DESCRIPTION
The fs getserverprefs command displays preference ranks for file server machine interfaces (file server machines run the fs process) or, if the -vlserver flag is provided, for Volume Location (VL) Server machines (which run the vlserver process). For file server machines, the Cache Manager tracks up to 15 interfaces per machine and assigns a separate rank to each interface. The ranks indicate the order in which the local Cache Manager attempts to contact the interfaces of machines that are housing a volume when it needs to fetch data from the volume. For VL Server machines, the ranks indicate the order in which the Cache Manager attempts to contact a cell's VL Servers when requesting VLDB information. For both types of rank, lower integer values are more preferred. The Cache Manager stores ranks in kernel memory. Once set, a rank persists until the machine reboots, or until the fs setserverprefs command is used to change it. fs_setserverprefs(1) explains how the Cache Manager sets default ranks, and how to use that command to change the default values. Default VL Server ranks range from 10,000 to 10,126. The Cache Manager assigns ranks to every machine listed in its copy of the /etc/openafs/CellServDB file or found via DNS AFSDB or SRV records for the cell when it initializes. When the Cache Manager needs to fetch VLDB information from a cell, it compares the ranks for the VL Server machines belonging to that cell, and attempts to contact the VL Server with the lowest integer rank. If the Cache Manager cannot reach the VL Server (because of server process, machine or network outage), it tries to contact the VL Server with the next lowest integer rank, and so on. If all of a cell's VL Server machines are unavailable, the Cache Manager cannot fetch data from the cell. Default file server ranks range from 5,000 to 40,000, excluding the range used for VL Servers (10,000 to 10,126); the maximum possible rank is 65,534. When the Cache Manager needs to fetch data from a volume, it compares the ranks for the interfaces of machines that house the volume, and attempts to contact the interface that has the lowest integer rank. If it cannot reach the fileserver process via that interface (because of server process, machine or network outage), it tries to contact the interface with the next lowest integer rank, and so on. If it cannot reach any of the interfaces for machines that house the volume, it cannot fetch data from the volume. For both file server machines and VL Server machines, it is possible for a machine or interface in a foreign cell to have the same rank as a machine or interface in the local cell. This does not present a problem, because the Cache Manager only ever compares ranks for machines belonging to one cell at a time. OPTIONS
-file <output file> Specifies the full pathname of a file to which to write the preference ranks. If the specified file already exists, the command overwrites its contents. If the pathname is invalid, the command fails. If this argument is not provided, the preference ranks appear on the standard output stream. -numeric Displays the IP addresses of file server machine interfaces or VL Server machines, rather than their hostnames. If this argument is not provided, the fs command interpreter has the IP addresses translated to hostnames such as "fs1.abc.com". -vlservers Displays preference ranks for VL Server machines rather than file server machine interfaces. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The output consists of a separate line for each file server machine interface or VL Server machine, pairing the machine's hostname or IP address with its rank. The Cache Manager stores IP addresses in its kernel list of ranks, but the command by default identifies interfaces by hostname, by calling a translation routine that refers to either the cell's name service (such as the Domain Name Server) or the local host table. If an IP address appears in the output, it is because the translation attempt failed. To bypass the translation step and display IP addresses rather than hostnames, include the -numeric flag. This can significantly speed the production of output. By default, the command writes to the standard output stream. Use the -file argument to write the output to a file instead. EXAMPLES
The following example displays the local Cache Manager's preference ranks for file server machines. The local machine belongs to the AFS cell named abc.com, and in this example the ranks of file server machines in its local cell are lower than the ranks of file server machines from the foreign cell, "def.com". It is not possible to translate the IP addresses of two machines on the 138.255 network. % fs getserverprefs fs2.abc.com 20007 fs3.abc.com 30002 fs1.abc.com 20011 fs4.abc.com 30010 server1.def.com 40002 138.255.33.34 40000 server6.def.com 40012 138.255.33.37 40005 The following example shows hows the output displays IP addresses when the -numeric flag is included, and illustrates how network proximity determines default ranks (as described on the fs setserverprefs reference page). The local machine has IP address 192.12.107.210, and the two file server machines on its subnetwork have ranks of 20,007 and 20,011. The two file server machines on a different subnetwork of the local machine's network have higher ranks, 30,002 and 30,010, whereas the ranks of the remaining machines range from 40,000 to 40,012 because they are in a completely different network. % fs getserverprefs -numeric 192.12.107.214 20007 192.12.105.99 30002 192.12.107.212 20011 192.12.105.100 30010 138.255.33.41 40002 138.255.33.34 40000 138.255.33.36 40012 138.255.33.37 40005 The example shows how the -vlservers flag displays preference ranks for VL Server machines: % fs getserverprefs -vlservers fs2.abc.com 10052 fs3.abc.com 10113 fs1.abc.com 10005 PRIVILEGE REQUIRED
None SEE ALSO
fs_setserverprefs(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 FS_GETSERVERPREFS(1)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy