Sponsored Content
Top Forums Shell Programming and Scripting awk remove/grab lines from file with pattern from other file Post 302966347 by RudiC on Thursday 11th of February 2016 03:59:46 AM
Old 02-11-2016
Not sure how to discriminate this new problem from the other. Does it come on top or in place? Some decent samples could help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search file for pattern and grab some lines before pattern

I want to search a file for a string and then if the string is found I need the line that the string is on - but also the previous two lines from the file (that the pattern will not be found in) This is on solaris Can you help? (2 Replies)
Discussion started by: frustrated1
2 Replies

2. Shell Programming and Scripting

shell script to remove all lines from a file before a line starting with pattern

hi,, i hav a file with many lines.i need to remove all lines before a line begginning with a specific pattern from the file because these lines are not required. Can u help me out with either a perl script or shell script example:- if file initially contains lines: a b c d .1.2 d e f... (2 Replies)
Discussion started by: raksha.s
2 Replies

3. Shell Programming and Scripting

Getting lines before and until next pattern in file /awk, sed

Hi, I need to get specific parts in a large file. I need to: Get a line containing an IP address, and read from there to another line saying ***SNMP-END*** So, I have the start and the end well defined, but the problem is that apparently the awk command using the -F option doesn't work... (17 Replies)
Discussion started by: ocramas
17 Replies

4. Shell Programming and Scripting

How to grab a block of data in a file with repeating pattern?

I need to send email to receipient in each block of data in a file which has the sender address under TO and just send that block of data where it ends as COMPANY. I tried to work this out by getting line numbers of the string HELLO but unable to grab the next block of data to send the next... (5 Replies)
Discussion started by: loggedout
5 Replies

5. UNIX for Dummies Questions & Answers

awk -remove pattern from file

I have a file like this - I want to remove the 2015 (or any four digit #) from column $4 so I can get: Nov 05 1997 /ifs/inventory2/ for example. Im not sure how. Should I use an if statement with awk? Jan 16 2015 23:45 /ifs/sql_file Jan 16 2015 23:45 /ifs/sql_file Nov 05 2015 1997... (4 Replies)
Discussion started by: newbie2010
4 Replies

6. Shell Programming and Scripting

awk to remove lines in file if specific field matches

I am trying to remove lines in the target.txt file if $5 before the - in that file matches sorted_list. I have tried grep and awk. Thank you :). grep grep -v -F -f targets.bed sort_list grep -vFf sort_list targets awk awk -F, ' > FILENAME == ARGV {to_remove=1; next} > ! ($5 in... (2 Replies)
Discussion started by: cmccabe
2 Replies

7. Shell Programming and Scripting

Using awk to remove lines from file that match text

I am trying to remove each line in which $2 is FP or RFP. I believe the below will remove one instance but not both. Thank you :). file 12 123 FP 11 10 RFP awk awk -F'\t' ' $2 != "FP"' file desired output 12 11 (6 Replies)
Discussion started by: cmccabe
6 Replies

8. UNIX for Beginners Questions & Answers

awk function to remove lines that contain contents of another file

Hi, I'd be grateful for your help with the following. I have a file (file.txt) with 10 columns and about half a million lines, which in simplified form looks like this: ID Col1 Col2 Col3.... a 4 2 8 b 5 6 1 c 8 4 1 d... (4 Replies)
Discussion started by: aberg
4 Replies

9. UNIX for Beginners Questions & Answers

awk to remove pattern and lines above pattern

In the awk below I am trying to remove all lines above and including the pattern Test or Test2. Each block is seperated by a newline and Test2 also appears in the lines to keep but it will always have additional text after it. The Test to remove will not. The awk executed until the || was added... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies
TPROF(8)						    BSD System Manager's Manual 						  TPROF(8)

NAME
tprof -- record tprof profiling samples SYNOPSIS
tprof [-c] [-o file] command ... DESCRIPTION
The tprof is a sampling based profiler. tprof utility makes the kernel driver start profiling, executes the specified command, keeps recording samples from the kernel driver until the command finishes, and reports statistics to the standard error. The tprof pseudo driver and a suitable backend should be loaded beforehand. The tprof utility accepts the following options. -o file Write the collected samples to the file named file. The default is ``tprof.out''. -c Write the collected samples to the standard output. Note that the output is a binary stream. EXAMPLES
The following command profiles the system during 1 second and shows the top-10 kernel functions which likely consumed CPU cycles. tprof -c sleep 1 2>/dev/null | tpfmt -skCLP | head -10 DIAGNOSTICS
The tprof utility reports the following statistics about the activities of the tprof pseudo driver. sample The number of samples collected and prepared for userland consumption. overflow The number of samples dropped because the per-CPU buffer was full. buf The number of buffers successfully prepared for userland consumption. emptybuf The number of buffers which have been dropped because they were empty. dropbuf The number of buffers dropped because the number of buffers kept in the kernel exceeds the limit. dropbuf_samples The number of samples dropped because the buffers containing the samples were dropped. SEE ALSO
tpfmt(1), tprof(4) AUTHORS
The tprof utility is written by YAMAMOTO Takashi. CAVEATS
The contents and representation of recorded samples are undocumented and will likely be changed for future releases of NetBSD in an incompat- ible way. BSD
November 26, 2011 BSD
All times are GMT -4. The time now is 02:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy