Sponsored Content
Top Forums Shell Programming and Scripting Last occurrence of code between two tags Post 302591551 by mirni on Thursday 19th of January 2012 11:12:24 PM
Old 01-20-2012
Scrutinizer's solutions are elegant and correct for the input you posted.
What syntax error are you getting from the first command? Awk should tell you where the syntax error is:
Code:
$ awk '/user1/& &/response2/{p=$0}END{print p}' RS= xxx.log
awk: /user1/& &/response2/{p=$0}END{print p}
awk:         ^ syntax error

Notice the caret ('^') in the last line. It points to the position of syntax error.
Are your responses really separated by an empty line?
Can you please post a sample from your real input? (Use code tags).
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace second occurrence only

HPUX /bin/sh (posix) I have a file as such cat dog mouse deer elk rabbit mouse rat pig I would like to replace the second occurrence of mouse in this file with mouse2. The rest of the file has to stay exactly as is. I'm not sure exactly where mouse might be (could be first,second,third... (5 Replies)
Discussion started by: lyoncc
5 Replies

2. Shell Programming and Scripting

number of occurrence

: i need a bash script to convert the displayed output 12 14 15 12 15 13 to 12 * 2 ,13 * 1,14*1,15*1 Thanks, nevil (2 Replies)
Discussion started by: nevil
2 Replies

3. Shell Programming and Scripting

Substitute first occurrence of keyword if occurrence between two other keywords

Assume a string that contains one or multiple occurrences of three different keywords (abbreviated as "kw"). I would like to replace kw2 with some other string, say "qux". Specifically, I would like to replace that occurrence of kw2 that is the first one that is preceded by kw1 somewhere in the... (4 Replies)
Discussion started by: M Gruenstaeudl
4 Replies

4. UNIX for Dummies Questions & Answers

Code for exact match to count occurrence

Hi all, I have an input file as below. I would like to count the occurrence of pattern matching 8th field for each line. Input: field_01 field_02 field_03 field_04 field_05 field_06 field_07 field_08 TA T TA T TA TA TA... (3 Replies)
Discussion started by: huiyee1
3 Replies

5. Shell Programming and Scripting

sed print from last occurrence match until the end of last occurrence match

Hi, i have file file.txt with data like: START 03:11:30 a 03:11:40 b END START 03:13:30 eee 03:13:35 fff END jjjjjjjjjjjjjjjjjjjjj START 03:14:30 eee 03:15:30 fff END ggggggggggg iiiiiiiiiiiiiiiiiiiiiiiii I want the below output START (13 Replies)
Discussion started by: Jyotshna
13 Replies
DH_AUTO_INSTALL(1)						     Debhelper							DH_AUTO_INSTALL(1)

NAME
dh_auto_install - automatically runs make install or similar SYNOPSIS
dh_auto_install [buildsystemoptions] [debhelperoptions] [--params] DESCRIPTION
dh_auto_install is a debhelper program that tries to automatically install built files. It does so by running the appropriate command for the build system it detects the package uses. For example, if there's a Makefile and it contains a install target, then this is done by running make (or MAKE, if the environment variable is set). If there is a setup.py or Build.PL, it is used. Note that the Ant build system does not support installation, so dh_auto_install will not install files built using Ant. Unless --destdir option is specified, the files are installed into debian/package/ if there is only one binary package. In the multiple binary package case, the files are instead installed into debian/tmp/, and should be moved from there to the appropriate package build directory using dh_install(1). DESTDIR is used to tell make where to install the files. If the Makefile was generated by MakeMaker from a Makefile.PL, it will automatically set PREFIX=/usr too, since such Makefiles need that. This is intended to work for about 90% of packages. If it doesn't work, or tries to use the wrong install target, you're encouraged to skip using dh_auto_install at all, and just run make install manually. OPTIONS
See "BUILD SYSTEM OPTIONS" in debhelper(7) for a list of common build system selection and control options. --destdir=directory Install files into the specified directory. If this option is not specified, destination directory is determined automatically as described in the "DESCRIPTION" section. -- params Pass params to the program that is run, after the parameters that dh_auto_install usually passes. SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Joey Hess <joeyh@debian.org> 11.1.6ubuntu2 2018-05-10 DH_AUTO_INSTALL(1)
All times are GMT -4. The time now is 08:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy