Sponsored Content
Top Forums Shell Programming and Scripting awk between items including items Post 302267478 by Ikon on Friday 12th of December 2008 12:31:28 PM
Old 12-12-2008
awk between items including items

OS=HP-UX ksh

The following works, except I want to include the <start> and <end> in the output.

Code:
awk -F '<start>' 'BEGIN{RS="<end>"; OFS="\n"; ORS=""} {print $2} somefile.log'

The following work in bash but not in ksh

Code:
sed -n '/^<start>/,/^<end>/{/LABEL$/!p}' somefile.log

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing items in 2 files

Hi, I have 2 files with contents in them and I need to compare each item in each file. File1: item4 item5 File2: item2 item3 item5 item6 The items names can be of different lengths. If the items in the File1 are not in File2, delete the missing item in File1. The resulting... (12 Replies)
Discussion started by: ReV
12 Replies

2. UNIX for Dummies Questions & Answers

queue items...

Hi everyone. I have a lot of programs i want to run on some data files, they need to be done sequentially. Often the output from one program is the input for the next. e.g $ progA data1 > data1.A $ progB data1.A > data1.AB $ progC data1.AB > data1.ABC repeat on data2, 3, 4, 5, 6 etc ... (4 Replies)
Discussion started by: Jay-pea
4 Replies

3. Shell Programming and Scripting

Matching 2 items in a string

Little lost here, I am trying to search a line for both values after the $ signs. My ultimate goal is to get percertage. <?php $string = "Something on sale for $4 and orginal price $10"; $strstr =. strstr($string, '$'); $strrchr =. strrchr($string, '$'); echo "$strstr<br>"; echo... (1 Reply)
Discussion started by: mrlayance
1 Replies

4. Programming

Removing Items In A ListView

Hi everyone! So I have a listView on my Form named "officeView" I already have the code to add and update info into it, but Im having troubles deleting items out of it. :/ Now I know how to delete an Item from the listView, but I want the item before the deleted item to become automatically... (0 Replies)
Discussion started by: romeo5577
0 Replies

5. Shell Programming and Scripting

Moving items to a new line

Hi, Let's I have the following strings (md5): 07177edf8261d28c6a003e583fcbe38c 0717c0037b3a20fc0f0998e673f228d5 0717d611a5d24374628b98e17fd00977,0717d611a5d24374628b98e17fd00977 07189a18afdae558bb5aadfe602e4a91 0719e97d481c239667f38a3e166bed74 071af3225fe50a1fdbb42c43aac313cc... (4 Replies)
Discussion started by: talfiq
4 Replies

6. Shell Programming and Scripting

awk, help me - counting items and listing them

This is my first ever post... please help! :o I have two columns....here is part of the file... 12, 46798 6692, 46799 5710, ... (3 Replies)
Discussion started by: pelhabuan
3 Replies

7. UNIX for Dummies Questions & Answers

awk colon separated items

Hi, I need to filter my data based on items in column 23. Column 1 until column 23 are tab separated. This is how column 23 looks like: PRIMARY=<0/1:504:499,5:.:.:.:0.01:1:15:.> I want to extract lines if items 7 (separated by : ) in column 23 are more than 0.25 . In example above , item... (2 Replies)
Discussion started by: janshamsani
2 Replies

8. Shell Programming and Scripting

awk - function to return permutations of n items out of m

Hi, I'm trying to write an awk function that returns all possible permutations of n items chosen in a list of m items. For example, given the input "a,b,c,d,e" and 3, the function should return the following : a a a a a b a a c a b a a b b ... c a a c a b ... e e c e e d e e e (125... (21 Replies)
Discussion started by: cjnwl
21 Replies

9. UNIX for Beginners Questions & Answers

Foreach not looping through all items

Hello, very new to this and have to use tcsh (not a choice at the moment). I need to convert files within sub directories. My foreach loops don't work. Directories are as follow: sub-001 --ses-T1 ---- anat --------File.nii --ses-T2 ----anat -------File.nii sub-002 and so on. ... (2 Replies)
Discussion started by: IlaBert
2 Replies

10. Shell Programming and Scripting

Pass an array to awk to sequentially look for a list of items in a file

Hello, I need to collect some statistical results from a series of files that are being generated by other software. The files are tab delimited. There are 4 different sets of statistics in each file where there is a line indicating what the statistic set is, followed by 5 lines of values. It... (8 Replies)
Discussion started by: LMHmedchem
8 Replies
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy