Sponsored Content
Top Forums Shell Programming and Scripting Help with order lines from a file based on a pattern Post 302921437 by RudiC on Friday 17th of October 2014 04:41:56 AM
Old 10-17-2014
Try
Code:
awk '/IMSI/ && NR>1 {printf "\n"}; END {printf "\n"} {printf "%s %s ",$1, $NF}' ORS=" " file
IMSI 1234567890 APN INTERNET.COM APN MMS.COM APN WAP.COM APN BA.COM
IMSI 0123456789
IMSI 1234567890 APN INTERNET.COM APN MMS.COM APN WAP.COM APN BA.COM

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

selecting only few lines from many based on a common pattern

Hi, I have a file having some thousand records with the following sort of lines: Error: Failed to get order data Order: PO-BBBTGZE Error: No CLI Error: Failed to get order data Order: PO-SBDJUZA Order: PO-XBBIDEN Error: No CLI Error: Failed to get order data Order: PO-BBDJUTQ Order:... (2 Replies)
Discussion started by: damansingh
2 Replies

2. Shell Programming and Scripting

Combine the lines based on particular pattern

Hi, I've a weird problem to be solved. Assume i have a file like this: 1. <timestamp> UID: 12345 <junk> DevID: V123 2. <timestamp>DevID: V123 <junk> DuID: VP 3. ... 4. .... 5. <timestamp> UID: 789 <junk> DevID: S456 6. <timestamp>DevID: S456 <junk> DuID: VP.... 7. ..... Say if i... (3 Replies)
Discussion started by: VenkataPrasad
3 Replies

3. Shell Programming and Scripting

Merge lines in text file based on pattern

Hello, I have searched forum trying to find a solution to my problem, but could not find anything or I did not understand the examples.... I should say, I am very inexperienced with text processing. I have a text file with approx 60k lines in it. I need to merge lines based on the number... (8 Replies)
Discussion started by: Bertik
8 Replies

4. UNIX for Dummies Questions & Answers

print multiple lines from text file based on pattern list

I have a text file with a list of items/patterns: ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig12238 ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig34624... (1 Reply)
Discussion started by: Oyster
1 Replies

5. Shell Programming and Scripting

Need to merge lines based on pattern

Hi, I have a requirement to merge multiple lines based on search pattern. The search criteria is : it will search for CONSTRAINT and when it found CONSTRAINT, it will merge all lines to 1 line till it founds blank line. For Example: CREATE TABLE "AMS_DISTRIBUTOR_XREF" ( "SOURCE"... (5 Replies)
Discussion started by: satyaatcgi
5 Replies

6. Shell Programming and Scripting

Help with ksh-to read ip file & append lines to another file based on pattern match

Hi, I need help with this- input.txt : L B white X Y white A B brown M Y black Read this input file and if 3rd column is "white", then add specific lines to another file insert.txt. If 3rd column is brown, add different set of lines to insert.txt, and so on. For example, the given... (6 Replies)
Discussion started by: prashob123
6 Replies

7. Shell Programming and Scripting

File w/ many line pairs--how do I order based on 1st lines only?

I have a file in which the data is stored in pairs of lines. The first line (beginining with ">") is a header, the second line is a sequence. I would like to sort the file by species name. Desired output for the example file: I can use sort -t'_' -k2 to alphabetize headers in the... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

8. Shell Programming and Scripting

Help with a deleting lines based on a pattern

I have a header-detail file that goes like this: SHP00288820131021110921 ORDER0156605920131021110921INMMMMFN DETAIL0004 4C2Z 10769 AAFC 0000009600000094 4C2Z 10769 AAFC 0000672107 OIL DETAIL0002 ER3Z 14300 E 0000001300000012 ER3Z 14300 E 0000672107 OIL... (3 Replies)
Discussion started by: rbaggio666
3 Replies

9. UNIX for Beginners Questions & Answers

Extract some characters from lines based on pattern

Hi All, i would like to get some help regarding extracting certain characters from a line grepped. blahblah{1:F01IRVTUS30XXXX0000000001}{2:I103IRVTDEF0XXXXN}{4:blah blahblah{1:F01IRVTUS30XXXX0000000001}{2:I103IRVTDEF0XXXXN}{4:blah... (10 Replies)
Discussion started by: mad man
10 Replies

10. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
UHSOCTL(1)						    BSD General Commands Manual 						UHSOCTL(1)

NAME
uhsoctl -- connection utility for Option based devices SYNOPSIS
uhsoctl [-a apn] [-c cid] [-p pin] [-u username] [-k password] [-r path] [-f path] [-b | -n] interface uhsoctl -d interface uhsoctl -h DESCRIPTION
uhsoctl is a small connection utility for Option N.V. devices that are based on Options packet interface and uses proprietary AT_* calls to establish connections. The utility (tries to) configure both default route and name servers (/etc/resolv.conf). By default uhsoctl detaches from the terminal upon on a successful connection, a few command-line options exists that allows this behavior to be changed. uhsoctl attempts to find a usable controlling serial port based on the provided network interface. If this fails you might specify a serial port manually. OPTIONS
-a apn Specify APN to connect to. -c cid Specify CID (Context ID) to use, by default CID 1 is used. If an APN has been configured once, it's enough to specify the CID used for further accesses. -p pin Specify SIM PIN. -u username Specify username. -k password Specify username. -r path Path to resolv.conf, default /etc/resolv.conf. Use /dev/null to disable updating of name servers. -f path Explicitly set the serial port to use as controlling terminal. Might be needed if the automatic detection fails. -b Fork into background directly, before a connection has been established. -n Never fork into background, run entirely in foreground. EXAMPLES
Connect to ``apn.example.com'' on interface ``uhso0'' and use PIN ``1234'' to enable the SIM card. uhsoctl -a apn.example.com -p 1234 uhso0 Disconnect from a previously established connection. uhsoctl -d uhso0 SEE ALSO
uhso(4) BSD
Aug 12, 2009 BSD
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy