Sponsored Content
Top Forums Shell Programming and Scripting Looping in case of duplicates Post 302862675 by barath on Friday 11th of October 2013 08:50:28 AM
Old 10-11-2013
Hammer & Screwdriver Looping in case of duplicates

Code:
14`~abc`~9`~11
14`~abc`~9`~10
36`~ee`~7`~9
36`~ee`~8`~9
58`~rtt`~12`~7
70`~gff`~13`~8
86`~tyu`~6`~12
86`~tyu`~6`~13
92`~mjh`~5`~6
28`~jkl`~10`~DNA
32`~mjk`~SNA`~5
82`~jkli`~11`~DNA

------------------------------------

Field Seperator: `~
The concept is to start with SNA in the 3rd Field.
Fetch the 4th field, search that 4th field content in the
third field of some other line , save the 1st field, get that line's 4th field and so on till
I reach DNA in the 4th field.
I have already developed part of the script which does that. But I am not sure how to handle, when I search for 4th field content in 3rd field, if it has more than one occurance.
I am getting the below output:
Code:
32~92~86~58~36~14~82

Expected output for the above example:
Code:
32~92~86~58~36~14~82
32~92~86~58~36~14~28
32~92~86~70~36~14~82
32~92~86~70~36~14~28

Could some one plz help me with this logic approach with unix script.

Thanks in Advance

Last edited by Franklin52; 10-11-2013 at 10:20 AM.. Reason: Please use code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies

2. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

3. SCO

Avoiding duplicates with some special case

Hi Gurus, I had a question regarding avoiding duplicates.i have a file abc.txt abc.txt ------- READER_1_1_1> HIER_28056 XML Reader: Error occurred while parsing:; line number ; column number READER_1_3_1> Sun Mar 23 23:52:48 2008 READER_1_3_1> HIER_28056 XML Reader: Error occurred while... (0 Replies)
Discussion started by: pssandeep
0 Replies

4. Shell Programming and Scripting

data array needs to change upper case to lower case

Hi all, i have a data array as followes. ARRAY=DFSG345GGG ARRAY=234FDFG090 ARRAY=VDFVGBGHH so on.......... i need all english letters to be change to lower case. So i am expecting to see ARRAY=dfsg345ggg ARRAY=234fdfg090 ARRAY=vdfvgbghh so on........ If i have to copy this data in... (8 Replies)
Discussion started by: usustarr
8 Replies

5. Shell Programming and Scripting

sed ignoring case for search but respecting case for subtitute

Hi I want to make string substitution ignoring case for search but respecting case for subtitute. Ex changing all occurences of "original" in a file to "substitute": original becomes substitute Origninal becomes Substitute ORIGINAL becomes SUBSTITUTE I know this a little special but it's not... (1 Reply)
Discussion started by: kmchen
1 Replies

6. Shell Programming and Scripting

Conversion from Upper Case to Lower Case Condition based

Hello Unix Gurus : It would be really appreciative if can find a solution for this . I have records in a file . I need to Capitalize the records based on condition . For Example i tried the following Command COMMAND --> fgrep "2000YUYU" /export/home/oracle/TST/data.dat | tr '' ''... (12 Replies)
Discussion started by: tsbiju
12 Replies

7. Shell Programming and Scripting

multiple looping with case and funtion showing error, Please help

Hello All, I have code as follows :- while true do {opening a case1 statement} 1) {opening another case2 statement} {closing case 2} 2) Showing error for "2)" as Syntax error at line 59 : `)' is not expected. *) {closing case 1} ... (5 Replies)
Discussion started by: Renjesh
5 Replies

8. Shell Programming and Scripting

Looping in case of duplicates ...

complinagetest () #function name { if ;then rm complins.dat fi touch complins.dat i=0 while read line do if ; then va=`grep -w "$line" datalins1.dat | awk BEGIN'{FS="\`~"}{if ( $3=="'$line'" ) {print $4}}'` i=$(($i+1)) varits=$(echo $va|awk -v varif="$i" '{print... (1 Reply)
Discussion started by: amitpaul01
1 Replies

9. Shell Programming and Scripting

Change first letter of a word from lower case to upper case

Hi all, I am trying to find a way to change first letter in a word from lower case to upper case. It should be done for each first word in text or in paragraph, and also for each word after punctuation like . ; : ! ?I found the following command sed -i 's/\s*./\U&\E/g' $@ filenamebut... (7 Replies)
Discussion started by: georgi58
7 Replies
Field(3pm)						  LogReport's Lire Documentation						Field(3pm)

NAME
Lire::Field - Interface to Dlf field's specification. SYNOPSIS
my $field = $schema->field( 'time' ); print "Name: ", $field->name(), " ", "Type: ", $field->type(), " "; DESCRIPTION
This module represents Dlf field's specifications. You'll get reference to this kind of object when you call the field(), timestamp_field() or fields() methods on a Lire::DlfSchema(3pm) object. You can obtain information about this field by querying its methods. OBJECT METHODS
name() Returns the name of the field. label() Returns the default label that should be used for column containing values from this field. pos() Returns the field's position in the record. Field's positions are indexed from 0. type() Returns the field's type. This will be a string describing the type's name as used in the XML specifications. sql_type() Returns the SQL type that should be used to hold this field's values. default() This method is obsolete since field don't have default anymore. description() This method will return the field's description. (This is the content of the description element in the XML specification.) Be aware that this will most likely contains DocBook markup. SEE ALSO
Lire::DlfSchema(3pm) Lire::DataTypes(3pm) AUTHORS
Francis J. Lacoste <flacoste@logreport.org> Wolfgang Sourdeau <wolfgang@logreport.org> VERSION
$Id: Field.pm,v 1.18 2006/07/23 13:16:29 vanbaal Exp $ COPYRIGHT
Copyright (C) 2001-2004 Stichting LogReport Foundation LogReport@LogReport.org This file is part of Lire. Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 Field(3pm)
All times are GMT -4. The time now is 11:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy