Sponsored Content
Top Forums Shell Programming and Scripting Copy a field into n line in another place Post 302636809 by Scrutinizer on Tuesday 8th of May 2012 03:39:42 AM
Old 05-08-2012
alright, try:
Code:
awk '!n{dd=$1 $2; n=1; next} {sub($2 FS substr($3,1,1),"? ? ? "); $4="? " dd; NF=8} /^###/{$0=$1; n=0}1' infile


Last edited by Scrutinizer; 05-08-2012 at 05:01 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting the value of a line, that changes place

Hi I am trying to get the value of several results in a file called seq032.diag. The values I am looking for is down under Smooth Tracking nodes and is for g01r01 g02r01 s01t02 etc etc. The problem is that when I try to use look for text and tail etc, it works fine in one result file. In... (1 Reply)
Discussion started by: Navigatorchief
1 Replies

2. Solaris

What is the best way to copy data from place to another place?

Dear Gurus, I need you to advice or suggestion about the best solution to copy data around 200-300G from serverA(location A) to serverB(location B). Normally, I will share folder and then copy but it takes too long time(about 2 days). Do you have any suggestion or which way should be... (9 Replies)
Discussion started by: unitipon
9 Replies

3. UNIX for Dummies Questions & Answers

Copy dir/file from one place to another.

Hello all. I'm not getting the hang of Paths. I have a dir w/files that I want to copy to another dir. Right now I am in the "source" directory. I want to copy it to Ch7. "cp -r source Ch7". Ch7 was already created. 1st msg.: cannot stat `source`: No such file or dir. I typed pwd & got... (3 Replies)
Discussion started by: Ccccc
3 Replies

4. UNIX for Dummies Questions & Answers

using gsed with cp to sort files in directory - every N file copy to new place

Hi all, I'm having a problem with some basic piping issues... I have been able to get in a directory and ls | gsed in order to list every N file for instance: ls | gsed -n '2~5p' The thing is I want to be able to copy the output files to a new directory. Basically directory /all has a... (4 Replies)
Discussion started by: dgoss
4 Replies

5. Shell Programming and Scripting

Compare Field in Current Line with Field in Previous

Hi Guys I have the following file Essentially, I am trying to find the right awk/sed syntax in order to produce the following 3 distinct files from the file above: Basically, I want to print the lines of the file as long as the second field of the current line is equal to the... (9 Replies)
Discussion started by: moutaye
9 Replies

6. Shell Programming and Scripting

How to update field value in place?

Dear all: I have a file: 1:00 2:abc 3:12asweand I ran the following awk script on this file: #!/usr/bin/awk -f { i= 1; while(i<=NF) { $i=substr($i, 1, index($i, ":")-1); i++ } }I am expecting the file would become (after running... (7 Replies)
Discussion started by: littlewenwen
7 Replies

7. Shell Programming and Scripting

awk to place value at 24 field in a flat file issue

I am trying to add 0393 value at 24th feild using the below command, but its adding at all the lines including header and trailer Input file: ZHV|2657|D0217001|T|TXU|Z|PAN|20131112000552||||OPER| 754|52479| 492|489|SP40|1014570286334|20131111|20131201|14355334|CHAMELON... (1 Reply)
Discussion started by: Aditya_001
1 Replies

8. Shell Programming and Scripting

Add line in exact place

I have one big XML file which contains information about 100 jobs,"JOB JOBISN=" indicates that is a job so where ever tag starts with "JOB JOBISN=" then i need to add below highlighted line between "<INCOND NAME" and "<OUTCOND NAME" for all jobs.like this i want to add below highlighted line for... (7 Replies)
Discussion started by: katakamvivek
7 Replies

9. Red Hat

Remove new line for a particular place

Hello All, I have a text file which gets uploaded to tables using shells script. However before running that script I need to alter it, like in the below I have to firstly find the word 1234 and remove the new line from end of it. 1234,5678,fasfasasfsadf abc changes to... (11 Replies)
Discussion started by: Sandeep_sandy
11 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
AFSMONITOR(5)							AFS File Reference						     AFSMONITOR(5)

NAME
afsmonitor - Provides instructions for the afsmonitor command DESCRIPTION
The afsmonitor configuration file determines which machines the afsmonitor command probes for File Server or Cache Manager statistics and which statistics it gathers. Use the -config argument to the afsmonitor command to identify the configuration file to use. The instructions that can appear in the configuration file are as follows: cm <host name> Names a client machine for which to display Cache Manager statistics. The order of "cm" lines in the file determines the order in which client machines appear from top to bottom on the "System Overview" and "Cache Managers" output screens. fs <host name> Names a file server machine for which to display File Server statistics. The order of "fs" lines in the file determines the order in which file server machines appear from top to bottom on the "System Overview" and "File Servers" output screens. thresh (fs | cm) <field> <thresh> [<cmd>] [<arg> ...] Assigns the threshold value thresh to the statistic field, for either a File Server statistic ("fs") or a Cache Manager statistic ("cm"). The optional cmd field names a binary or script to execute each time the value of the statistic changes from being below thresh to being at or above thresh. A change between two values that both exceed thresh does not retrigger the binary or script. The optional arg fields are additional values that the afsmonitor program passes as arguments to the cmd command. If any of them include one or more spaces, enclose the entire field in double quotes. The afsmonitor program passes the following parameters to the cmd: <hostname> (fs|cm) <field> <thresh> <actual> [<arg> ...] The parameters "fs", "cm", <field>, <thresh>, and <arg> correspond to the values with the same name on the thresh line. The <hostname> parameter identifies the file server or client machine where the statistic has crossed the threshold, and the <actual> parameter is the actual value of <field> that exceeds the threshold value. Use the "thresh" line to set either a global threshold, which applies to all file server machines listed on "fs" lines or client machines listed on "cm" lines in the configuration file, or a machine-specific threshold, which applies to only one file server or client machine. o To set a global threshold, place the thresh line before any of the "fs" or "cm" lines in the file. o To set a machine-specific threshold, place the thresh line below the corresponding "fs" or "cm" line, and above any other "fs" or "cm" lines. A machine-specific threshold value always overrides the corresponding global threshold, if set. Do not place a "thresh fs" line directly after a "cm" line or a "thresh cm" line directly after a "fs" line. show (fs | cm) field/group/section Specifies which individual statistic, group of statistics, or section of statistics to display on the "File Servers" screen ("fs") or "Cache Managers" screen ("cm") and the order in which to display them. The appendix of afsmonitor statistics in the OpenAFS Administration Guide specifies the group and section to which each statistic belongs. Include as many "show" lines as necessary to customize the screen display as desired, and place them anywhere in the file. The top-to-bottom order of the "show" lines in the configuration file determines the left-to-right order in which the statistics appear on the corresponding screen. If there are no "show" lines in the configuration file, then the screens display all statistics for both Cache Managers and File Servers. Similarly, if there are no "show fs" lines, the "File Servers" screen displays all file server statistics, and if there are no "show cm" lines, the "Cache Managers" screen displays all client statistics. # comments Precedes a line of text that the afsmonitor program ignores because of the initial number ("#") sign, which must appear in the very first column of the line. For a list of the values that can appear in the field/group/section field of a "show" instruction, see the afsmonitor statistics appendix to the OpenAFS Administration Guide. SEE ALSO
afsmonitor(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 AFSMONITOR(5)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy