Sponsored Content
Top Forums UNIX for Advanced & Expert Users Need command for grepping pattern lines with subsequent lines Post 302776145 by hanson44 on Wednesday 6th of March 2013 03:02:21 AM
Old 03-06-2013
Do the PHC lines ALWAYS start with "PHC"?
It helps to exactly describe the problem.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace only 1st word of a line if it comes in the subsequent lines at same postion.

I have a file like this.. Maharastra Mumbai worli Maharastra Mumbai navy maharatra Pune Maharastra Nagpur Karnataka Bangalore Karnataka Mysore Karnataka Mangalore Punjab Amritsar punjab Jalandar my expected outcome should be like this Maharastra Mumbai worli ---------- ... (9 Replies)
Discussion started by: geeko
9 Replies

2. Shell Programming and Scripting

How to extract a substring and append to subsequent lines

Hi all,I am really new to Shell Scripting.I have the following doubt. Let us assume the one sample file which contains the below data HEADERCARMENTRACIE1555090414 PERIOD0905090501090531 DETAIL0645693037023073836 GROUNDAV 090501 01 GROUNDAV 090502 01 TRIP 0091282542 0905084101... (5 Replies)
Discussion started by: jaligamasriniva
5 Replies

3. Shell Programming and Scripting

How to search for keywords in subsequent lines

Hi all, I am looking for a coomand to search for the keywords in susequenct lines. Keyword1 in a line and Keyword2 in the very next line. Once i found the combination ineed to print the lines with patterns and the line above and one below. I am giving an example here: Keywords are :ERROR and... (12 Replies)
Discussion started by: rdhanek
12 Replies

4. Shell Programming and Scripting

search for keyword in subsequent lines and delete the second line

I have my data something like this I need to search for the keyword yyyy in the susequent lines and if it is present, delete the second line with keyword. In other words, if a keywords is found in two subsequent lines delete the second line. input data: aaaa bbbbb cccc dddd xxxx... (4 Replies)
Discussion started by: rdhanek
4 Replies

5. Shell Programming and Scripting

Grep and fetch subsequent lines also

Hi, I need to grep a pattern and fetch subsequent lines till end of the data-set. E.g., i have a file like: AA 1111 23 34 BB 45 56 78 CC 22 44 AA 2222 78 34 56 BB 22 56 67 68 23 CC 56 78 DD 33 55 77 AA 3333 46 BB 58 79 In above file i have 3-data sets where each set starts with... (6 Replies)
Discussion started by: prvnrk
6 Replies

6. Shell Programming and Scripting

Find pattern, and then last field from subsequent lines

I've got a log file, of the format Name: network1 Dropped packets: 15618 Dropped packets for IPv6: 27 Dropped packets: 74 Dropped packets for IPv6: 0 Failed RADIUS Authentication procedures: 0 Failed RADIUS Accounting procedures: 0 Name: network2 Dropped packets: 1117 ... (18 Replies)
Discussion started by: Yorkie99
18 Replies

7. Shell Programming and Scripting

Finding lines matching the Pattern and their previous lines in a file

Hi, I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using: grep -w 'Possible network disconnect' file_name. But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies

8. Shell Programming and Scripting

awk - use fields from subsequent lines

I've run into a problem getting exactly what I want out of awk - some folks may recognize this as an output from Amazon's ec2-describe-instances: Given the following: INSTANCE i-4960f321 BLOCKDEVICE Line2Var2 TAG instance i-4960f321 Name web1 TAG instance i-4960f321... (2 Replies)
Discussion started by: colinjohnson
2 Replies

9. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

10. Shell Programming and Scripting

Printing next two lines from a file after grepping a specific pattern

Hi I have a file like # vi require.txt 1,BANK,Read blocks that cycle. yellow Read blocks. 2,ACCOUNT,Finished Red Finished . 3,LOAN, pipe white pipe 4,PROFIT,Resolve. black Resolve Am using like cat require.txt | grep -w ACCOUNTThe output I get is (8 Replies)
Discussion started by: Priya Amaresh
8 Replies
PHC2SYS(8)						      System Manager's Manual							PHC2SYS(8)

NAME
phc2sys - synchronize two clocks SYNOPSIS
phc2sys [ -wmqvx ] [ -d pps-device ] [ -s device ] [ -c device ] [ -O offset ] [ -P kp ] [ -I ki ] [ -S step ] [ -F step ] [ -R update-rate ] [ -N clock-readings ] [ -u summary-updates ] [ -n domain-number ] [ -l print-level ] DESCRIPTION
phc2sys is a program which synchronizes two clocks in the system. Typically, it is used to synchronize the system clock to a PTP hardware clock (PHC), which itself is synchronized by the ptp4l(8) program. Two synchronization modes are supported, one uses a pulse per second (PPS) signal provided by the source clock and the other mode reads time from the source clock directly. Some clocks can be used in both modes, the mode which will synchronize the slave clock with better accuracy depends on hardware and driver implementation. OPTIONS
-d pps-device Specify the PPS device of the master clock (e.g. /dev/pps0). With this option the PPS synchronization mode is used instead of the direct mode. As the PPS signal does not specify time and only marks start of a second, the slave clock should be already close to the correct time before phc2sys is started or the -s option should be used too. This option can be used only with the system clock as the slave clock. -s device Specify the master clock by device (e.g. /dev/ptp0) or interface (e.g. eth0) or by name (e.g. CLOCK_REALTIME for the system clock). When this option is used together with the -d option, the master clock is used only to correct the offset by whole number of sec- onds, which cannot be fixed with PPS alone. -i interface Performs the exact same function as -s for compatibility reasons. Previously enabled specifying master clock by network interface. However, this can now be done using -s and this option is no longer necessary. As such it has been deprecated, and should no longer be used. -c device Specify the slave clock by device (e.g. /dev/ptp1) or interface (e.g. eth1) or by name. The default is CLOCK_REALTIME (the system clock). -P kp Specify the proportional constant of the PI controller. The default is 0.7. -I ki Specify the integral constant of the PI controller. The default is 0.3. -S step Specify the step threshold of the PI controller. It is the maximum offset that the controller corrects by changing the clock fre- quency instead of stepping the clock. The clock is stepped on start regardless of the option if the offset is larger than 100 nanoseconds (unless the -F option is used). The value of 0.0 disables stepping after the start. The default is 0.0. -F step Specify the step threshold applied only on the first update. It is the maximum offset that is corrected by adjusting clock. The value of 0.0 disables stepping on start. The default is 0.0000001 (100 nanoseconds). -R update-rate Specify the slave clock update rate when running in the direct synchronization mode. The default is 1 per second. -N phc-num Specify the number of master clock readings per one slave clock update. Only the fastest reading is used to update the slave clock, this is useful to minimize the error caused by random delays in scheduling and bus utilization. The default is 5. -O offset Specify the offset between the slave and master times in seconds. See TIME SCALE USAGE below. -u summary-updates Specify the number of clock updates included in summary statistics. The statistics include offset root mean square (RMS), maximum absolute offset, frequency offset mean and standard deviation, and mean of the delay in clock readings and standard deviation. The units are nanoseconds and parts per billion (ppb). If zero, the individual samples are printed instead of the statistics. The mes- sages are printed at the LOG_INFO level. The default is 0 (disabled). -w Wait until ptp4l is in a synchronized state. If the -O option is not used, also keep the offset between the slave and master times updated according to the currentUtcOffset value obtained from ptp4l and the direction of the clock synchronization. -n domain-number Specify the domain number used by ptp4l. The default is 0. -x When a leap second is announced, don't apply it in the kernel by stepping the clock, but let the servo correct the one-second offset slowly by changing the clock frequency (unless the -S option is used). -l print-level Set the maximum syslog level of messages which should be printed or sent to the system logger. The default is 6 (LOG_INFO). -m Print messages to the standard output. -q Don't send messages to the system logger. -h Display a help message. -v Prints the software version and exits. TIME SCALE USAGE
Ptp4l uses either PTP time scale or UTC (Coordinated Universal Time) time scale. PTP time scale is continuous and shifted against UTC by a few tens of seconds as PTP time scale does not apply leap seconds. In hardware time stamping mode, ptp4l announces use of PTP time scale and PHC is used for the stamps. That means PHC must follow PTP time scale while system clock follows UTC. Time offset between these two is maintained by phc2sys. Phc2sys acquires the offset value either by reading it from ptp4l when -w is in effect or from command line when -O is supplied. Failure to maintain the correct offset can result in local system clock being off some seconds to domain master system clock when in slave mode, or incorect PTP time announced to the network in case the host is the domain master. EXAMPLES
The host is a domain master, PTP clock is synchronized to system clock and the time offset is obtained from ptp4l. Phc2sys waits for ptp4l to get at least one port in master or slave mode before starting the synchronization. phc2sys -c /dev/ptp0 -s CLOCK_REALTIME -w Same as above, time offset is provided on command line and phc2sys does not wait for ptp4l. phc2sys -c /dev/ptp0 -s CLOCK_REALTIME -O 35 The host is in slave mode, system clock is synchronized from PTP clock, phc2sys waits for ptp4l and the offset is set automatically. phc2sys -s /dev/ptp0 -w Same as above, PTP clock id is read from the network interface, the offset is provided on command line phc2sys does not wait. phc2sys -s eth0 -O -35 SEE ALSO
ptp4l(8) linuxptp November 2012 PHC2SYS(8)
All times are GMT -4. The time now is 10:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy