Sponsored Content
Full Discussion: Extract only first occurance
Top Forums UNIX for Beginners Questions & Answers Extract only first occurance Post 303015551 by arunkumar_mca on Friday 6th of April 2018 01:24:19 PM
Old 04-06-2018
Quote:
Originally Posted by RudiC
Any attempts / ideas / thoughts from your side?

First occurrence of what?

First occurance of first field. For example 11001 having many rows. I want to get only first row
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk: last occurance

Hi All, I need to extract the last occurance of a pattern match. So far I've got the code below which extracts the first occurance. Any ideas how I can modify it so that it extracts the last? BEGIN {} { if (data++ == 0) ... (17 Replies)
Discussion started by: pondlife
17 Replies

2. Shell Programming and Scripting

How to insert values in 1st occurance out of two occurance in a file

Hi I have a file which contains the following two lines which are same But I would like to insert the value=8.8.8.8 in the 1st occurance line and value=9.9.9.9 in the 2nd occurance line. <parameter name="TestIp1" value=""> <parameter name="TestIp1" value=""> Please suggest (1 Reply)
Discussion started by: madhusmita
1 Replies

3. Shell Programming and Scripting

Split on last occurance

I want to call a script like this: ./somescript some-thing.knows.what.ending Inside the script it needs to split at last .(period) so I can: a=some-thing.knows.what b=ending I know I can do it in perl but im still learing awk and sed. Thanks (3 Replies)
Discussion started by: Ikon
3 Replies

4. Shell Programming and Scripting

First occurance

A PERL script that prints just the first occurrence of a string in a file and immediately exits (the string and the filename are the first and the second command line arguments; I used filehandle to open an input file). (1 Reply)
Discussion started by: aadi_uni
1 Replies

5. Shell Programming and Scripting

extract till occurance of a string

hi , i have an xml that comes in a single, the entire xml file is read as a single line when i open in edit plus or unix. i need to amend the contents of this xml file. below is the extract from the file <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"... (5 Replies)
Discussion started by: sais
5 Replies

6. Shell Programming and Scripting

Trying to grep for '--' occurance

Hello Im trying to grep for a string in grub.conf . I've used the -F option since its a long string, but when i execute, i run into errors. Script and output below. GRUBPASSWD="password --md5 xyz" if grep -Fxq $GRUBPASSWD /etc/grub.conf then . . output: grep: unrecognized option... (5 Replies)
Discussion started by: bludhemn
5 Replies

7. Shell Programming and Scripting

replace every second occurance of a string

I want to replace every 2nd occurance of a string/character from a line. ababacbsbddbsbbcbdbssb i want to replace every s2nd b with @ like below should be like aba@acbs@ddbs@bc@dbss@ (3 Replies)
Discussion started by: ratheeshjulk
3 Replies

8. Shell Programming and Scripting

Multiple occurance of file

Hi all, I have file structure as file.log 84t-rw-r--r-- 1 emily04 us_cms 24492717 Oct 5 13:29 vgtree_84_1_K3L.root 85t-rw-r--r-- 1 emily04 us_cms 50410380 Oct 5 16:06 vgtree_85_1_uZv.root 85t-rw-r--r-- 1 emily04 us_cms 50567380 Oct 5 16:06 vgtree_85_1_hjv.root 86t-rw-r--r-- 1 emily04... (4 Replies)
Discussion started by: emily
4 Replies

9. Shell Programming and Scripting

Extract multiple occurance of strings between 2 patterns

I need to extract multiple occurance strings between 2 different patterns in given line. For e.g. in below as input ------------------------------------------------------------------------------------- mike(hussey) AND mike(donald) AND mike(ryan) AND mike(johnson)... (8 Replies)
Discussion started by: sameermohite
8 Replies

10. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies
All times are GMT -4. The time now is 12:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy