Sponsored Content
Top Forums Shell Programming and Scripting Group on the basis of common text in the square bracket and sorting Post 302443749 by ygemici on Tuesday 10th of August 2010 03:09:18 AM
Old 08-10-2010
MySQL

Code:
sed 's/\[/ \[/' al |sort -k4,1n -k1n >tmp
IFS=$'\n'
 for i in `cat tmp | cut -d"]" -f1 | sed 's/.*\[\(\.*\)/\1/'|uniq|sort`
    do
      sed "/$i/!d" tmp | sed -n '$p;s/ \[/[/'
    done
100  >aa [John 2] >abc[John 2]  >bca[John 2]
87 >def [Mona 3.1] >fgh[Mona 3.1] <ijk [Mona 3.1]
89  >fck [Rambo] >ghij[Rambo] >kill[Rambo] >aa[Rambo]

This User Gave Thanks to ygemici For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract string in square bracket

Hi Input text is some message some message some message Expected output is main value1 value2 value3 Any idea how to above values in square brackets using shell scripting? many thanks. (3 Replies)
Discussion started by: hnh
3 Replies

2. Shell Programming and Scripting

sorting of files on the basis of timestamp

Hi, With the help of below script im able to get the count of all the .xml files but that count is not specific to a day ie its the total count of all .xml files what i want is specific to 1 day and that of every half an hr ie from 23 feb 2009 7 am till 23rd feb 2009 2300 am and from 07:00 to... (1 Reply)
Discussion started by: ss_ss
1 Replies

3. Shell Programming and Scripting

Expect Script square bracket dollar prompt

Hi Thanks for this amazing forum first, I've been searching answers in it for problems that I've encountered at work. The only problem I haven't been able to find a fix for, is a ever waiting for prompt problem in Expect when encounter a $ prompt. I usually set the timeout to -1 cause the... (2 Replies)
Discussion started by: Ikaro0
2 Replies

4. Shell Programming and Scripting

perl : merging two arrays on basis of common parameter

I have 2 arrays, @array1 contains records in the format 1|_|X|_|ssd|_| 4|_|H|_|hbd|_| 9|_|Y|_|u8gjdfg|_| @array2 contains records in the format X|_|asdf|_| Y|_|qwer|_| A|_|9kdkf|_| @array3 should contain records in the PLz X|_|ssd|_|asdf|_| Y|_|hdb|_|qwer|_| PLZ dont use... (2 Replies)
Discussion started by: centurion_13
2 Replies

5. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

6. Shell Programming and Scripting

ksh, difference between double bracket and single bracket

Can somebody tell me the difference between double brackets and single brackets, when doing a test. I have always been acustomed to using single brackets and have not encountered any issues to date. Why would somebody use double brackets. Ie if ] vs if Thanks to... (2 Replies)
Discussion started by: BeefStu
2 Replies

7. Shell Programming and Scripting

Doubt with regex to replace square bracket

there is a word "welcome" output should be "welcome\ i am using regsub to add backslash "\" in place where ever i find square brackets (open or close).. But i am not getting it... pls help out.. set a {welcome} set d (5 Replies)
Discussion started by: Syed Imran
5 Replies

8. UNIX for Dummies Questions & Answers

Plz Help in sorting the data on date basis

I have file having below data 01-MAY-13 2.38.11.00.100089 IN 4512 0000741881 01-JUN-13 2.38.11.00.100089 IN 1514 0000764631 01-NOV-13 2.38.11.00.100089 IN 1514 0000856571 01-NOV-13 2.38.15.00.100015 IN 300.32 0000856531 01-JUN-13 2.38.19.00.100000 IN 2698 0000764493 01-JUL-13... (2 Replies)
Discussion started by: ranabhavish
2 Replies

9. Shell Programming and Scripting

Plz Help in sorting the data on date basis

I have file a.txt having below data cat a.txt 01-MAY-13 2.38.11.00.100089 IN 4512 0000741881 01-JUN-13 2.38.11.00.100089 IN 1514 0000764631 01-NOV-13 2.38.11.00.100089 IN 1514 0000856571 01-NOV-13 2.38.15.00.100015 IN 300.32 0000856531 01-JUN-13 2.38.19.00.100000 IN 2698 0000764493... (5 Replies)
Discussion started by: ranabhavish
5 Replies

10. Shell Programming and Scripting

Sorting on date basis

I have file data.txt having below data cat data.txt 01-MAY-13 2.38.11.00.100089 IN 4512 0000741881 01-MAY-13 2.38.11.00.100089 IN 4512 0000741881 01-JUN-13 2.38.11.00.100089 FC 1514 0000764631 01-NOV-13 2.38.11.00.100089 FC 1514 0000856571 01-NOV-13 2.38.11.00.100089 IN 300.32... (1 Reply)
Discussion started by: ranabhavish
1 Replies
RDF::vCard::Line(3pm)					User Contributed Perl Documentation				     RDF::vCard::Line(3pm)

NAME
RDF::vCard::Line - represents a line within a vCard DESCRIPTION
Instances of this class correspond to lines within vCards, though they could potentially be used as basis for other RFC 2425-based formats such as iCalendar. Constructor o "new(%options)" Returns a new RDF::vCard::Line object. The only options worth worrying about are: property (case-insensitive property name), value (arrayref or single string value), type_parameters (hashref of property-related parameters). RDF::vCard::Entity overloads stringification, so you can do the following: my $line = RDF::vCard::Line->new( property => 'email', value => 'joe@example.net', type_parameters => { type=>['PREF','INTERNET'] }, ); print "$line " if $line =~ /internet/i; Methods o "to_string()" Formats the line according to RFC 2425 and RFC 2426. o "add_to_model($model, $node)" Given an RDF::Trine::Model and an RDF::Trine::Node representing the entity (i.e. vcard) that this line belongs to, adds triples to the model for this line. o "property()" Returns the line's property - e.g. "EMAIL". o "property_node()" Returns the line's property as an RDF::Trine::Node that can be used as an RDF predicate. Returns undef if a sensible URI cannot be found. o "property_order()" Returns a string which can be used to sort a list of lines into a sensible order. o "value()" Returns an arrayref for the value. Each item in the arrayref could be a plain scalar, or an arrayref of scalars. For example the arrayref representing this name: N:Smith;John;Edward,James which is the vCard representation of somebody with surname Smith, given name John and additional names (middle names) Edward and James, might be represented with the following "value" arrayref: [ 'Smith', 'John', ['Edward', 'James'], ] or maybe: [ ['Smith'], 'John', ['Edward', 'James'], ] That's why it's sometimes useful to have a normalised version of it... o "nvalue()" Returns a normalised version of the arrayref for the value. It will always be an arrayref of arrayrefs. For example: [ ['Smith'], ['John'], ['Edward', 'James'], ] o "value_node()" Returns the line's value as an RDF::Trine::Node that can be used as an RDF object. For some complex properties (e.g. ADR, GEO, ORG, N, etc) the result is not especially useful. o "value_to_string()" Formats the line value according to RFC 2425 and RFC 2426. o "type_parameters()" Returns the type_parameters hashref. Here be monsters (kinda). SEE ALSO
RDF::vCard. AUTHOR
Toby Inkster <tobyink@cpan.org>. COPYRIGHT
Copyright 2011 Toby Inkster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-23 RDF::vCard::Line(3pm)
All times are GMT -4. The time now is 04:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy