Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Search word in 3rd column and move it to next column (4th) Post 302794521 by AK47 on Tuesday 16th of April 2013 08:59:49 AM
Old 04-16-2013
Code Search word in 3rd column and move it to next column (4th)

Hi, I have a file with +/- 13000 lines and 4 column. I need to search the 3rd column for a word that begins with "SAP-" and move/skip it to the next column (4th). Because the 3rd column need to stay empty.

Thanks in advance.Smilie

Code:
89653	36891	OTR-60	SAP-2
89653	36892	OTR-10	SAP-2
89653	36893	OTR-10	SAP-2
89653	36890	OTR-10	SAP-5
89653	36890	SAP-3	
89653	36895	OTR-10	SAP-2
89653	36890	OTR-10	SAP-2
89653	36898	SAP-5
89653	36890	OTR-60	SAP-2
89653	36890	SAP-2	
89653	36890	OTR-10	SAP-3


Code:
89653	36891	OTR-60	SAP-2
89653	36892	OTR-10	SAP-2
89653	36893	OTR-10	SAP-2
89653	36890	OTR-10	SAP-5
89653	36890		SAP-3	
89653	36895	OTR-10	SAP-2
89653	36890	OTR-10	SAP-2
89653	36898		SAP-5
89653	36890	OTR-60	SAP-2
89653	36890		SAP-2	
89653	36890	OTR-10	SAP-3

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to extract 3rd line 4th column of a file

Hi, Shell script: I would need help on How to extract 3rd line 4th column of a file with single liner Thanks in advance. (4 Replies)
Discussion started by: krishnamurthig
4 Replies

2. Shell Programming and Scripting

How to search for a word in a particular column of a file

How to search for a word like "computer" in a column (eg: 4th field) of a '***' delimited file and add a column at the end of the record which denotes 'Y' if present and 'N' if not. After this, we need to again check for words like 'Dell' but not 'DellXPS' in 5th field and again add another column... (5 Replies)
Discussion started by: Jassz
5 Replies

3. Shell Programming and Scripting

To search a word in particular column using awk

I have a data in a file like this 1 praveen bmscollege 2 shishira bnmit 3 parthiva geethamce I want to search "praveen" using awk command i tried like this but i did not get awk `$2="praveen" {print $0} ` praveen.lst can anyone help me solving this problem in... (2 Replies)
Discussion started by: praveenhegde
2 Replies

4. Shell Programming and Scripting

1st column,2nd column on first line 3rd,4th on second line ect...

I need to take one column of data and put it into the following format: 1st line,2nd line 3rd line,4th line 5th line,6th line ... Thanks! (6 Replies)
Discussion started by: batcho
6 Replies

5. Shell Programming and Scripting

AWK script to create max value of 3rd column, grouping by first column

Hi, I need an awk script (or whatever shell-construct) that would take data like below and get the max value of 3 column, when grouping by the 1st column. clientname,day-of-month,max-users ----------------------------------- client1,20120610,5 client2,20120610,2 client3,20120610,7... (3 Replies)
Discussion started by: ckmehta
3 Replies

6. Shell Programming and Scripting

Print every 5 4th column values as separate row with different first column

Hi, I have the following file, chr1 100 200 20 chr1 201 300 22 chr1 220 345 23 chr1 230 456 33.5 chr1 243 567 90 chr1 345 600 20 chr1 430 619 21.78 chr1 870 910 112.3 chr1 914 920 12 chr1 930 999 13 My output would be peak1 20 22 23 33.5 90 peak2 20 21.78 112.3 12 13 Here the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

7. Shell Programming and Scripting

Changing values only in 3rd column and 4th column

#cat file testing test! nipw asdkjasjdk ok! what !ok host server1 check_ssh_disk!102.56.1.101!30!50!/ other host server 2 des check_ssh_disk!192.6.1.10!40!30!/ #grep check file| awk -F! '{print $3,$4}'|awk '{gsub($1,"",$1)}1' 50 30 # Output: (6 Replies)
Discussion started by: kenshinhimura
6 Replies

8. Shell Programming and Scripting

Solution for replacement of 4th column with 3rd column in a file using awk/sed preserving delimters

input "A","B","C,D","E","F" "S","T","U,V","W","X" "AA","BB","CC,DD","EEEE","FFF" required output: "A","B","C,D","C,D","F" "S", T","U,V","U,V","X" "AA","BB","CC,DD","CC,DD","FFF" tried using awk but double quotes not preserving for every field. any help to solve this is much... (5 Replies)
Discussion started by: khblts
5 Replies

9. UNIX for Beginners Questions & Answers

UNIX script to compare 3rd column value with first column and display

Hello Team, My source data (INput) is like below EPIC1 router EPIC2 Targetdefinition Exp1 Expres rtr1 Router SQL SrcQual Exp1 Expres rtr1 Router EPIC1 Targetdefinition My output like SQL SrcQual Exp1 Expres Exp1 Expres rtr1 Router rtr1 Router EPIC1 Targetdefinition... (5 Replies)
Discussion started by: sekhar.lsb
5 Replies

10. UNIX for Beginners Questions & Answers

How to search for a word in column header that fully matches the word not partially in awk?

I have a multicolumn text file with header in the first row like this The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach for ii in ${hdr} do gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
SAP(7)								   Miscellaneous							    SAP(7)

NAME
sap - Service Access Point specification DESCRIPTION
The text2sap and sap2text functions use the format described in this man page. Because all standard ATM tools on Linux use those functions to convert to or from the textual representation of SAP specifications, they expect them in the same format too. The SAP is divided into two parts: the broadband high layer information (BHLI) and the broadband low layer information (BLLI). A SAP can contain one, both, or none of them. In the latter case, the SAP is usually considered as a wildcard SAP, i.e. a SAP that is compatible with any other SAP. Each part begins with its name (bhli or blli), followed by a colon and a (non-empty) list of attributes, which are of the form attribute=value. Some attributes have sub-attributes, which follow them. Everything that isn't separated by a colon or an equal sign is separated by a comma. Values which are a number of bytes are specified as the corresponding sequence of pairs of hex digits. The sequence can be optionally pre- fixed with 0x. Values with are integers in a given range can be specified in decimal (no prefix), octal (0 prefix), and hexadecimal (0x prefix). The following, mutually exclusive attributes are allowed in the bhli part (see the corresponding ATM Forum and ITU documents for the seman- tics): iso=1-8 bytes ISO user=1-8 bytes User-specific hlp=4 bytes High layer profile. Note that this attribute only exists on UNI 3.0. text2sap only recognizes it if your system is configured to accept UNI 3.0 message formats. oui=3 bytes,id=4 bytes Vendor-specific application identifier The structure of the bhli part is more complex. It distinguishes three layers, l1, l2, and l3, of which the first one is presently unsup- ported. For layer two, the following (mutually exclusive) possibilities exist: l2=iso1745 Basic mode ISO 1745 l2=q291 ITU-T Q.291 (Rec. I.441) l2=lapb Extended LAPB, half-duplex (Rec. T.71) l2=iso8802 LAN LLC (ISO/IEC 8802/2) l2=x75 ITU-T X.75, SLP l2=x25_ll ... ITU-T X.25, link layer. This attribute and the following attributes through l2=iso7776 can optionally be followed by one or more of the following sub-attributes: mode=mode (mode of operation, either norm or ext), and window=window size (window size in k, 1-127). l2=x25_ml ... ITU-T X.25, multilink l2=hdlc_arm ... HDLC ARM (ISO/IEC 4335) l2=hdlc_nrm ... HDLC NRM (ISO/IEC 4335) l2=hdlc_abm ... HDLC ABM (ISO/IEC 4335) l2=q992 ... ITU-T Q.922 l2=iso7776 ... ISO 7776 DTE-DTE l2=user,info=information User-specified. information is an integer in the range 0 to 255. For layer three, the following (again, mutually exclusive) possibilities exist: l3=iso8473 ITU-T X.233 | ISO/IEC 8473 l3=t70 ITU-T T.70 minimum network layer l3=h321 ITU-T Recommendation H.321 l3=x25 ... ITU-T X.25, packet layer. This attribute and the following attributes through l3=x223 can optionally be followed by one or more of the following sub-attributes: mode=mode (see above), size=default packet size (4-12, corresponding to 16-4096), window=window size (see above). l3=iso8208 ... ISO/IEC 8208 l3=x223 ... ITU-T X.223 | ISO/IEC 8878 l3=tr9577,ipi=identifier ... ISO/IEC TR 9577. identifier is the initial protocol identifier in the range 0-255. For SNAP (0x80), the keyword snap can be used, and the following sub-attributes have to be specified: oui=3 bytes, and pid=2 bytes. l2=user,info=information User-specified, see above. l3=h310 ... ITU-T Recommendation H.310. The sub-attribute term=type (terminal type, rx, tx, or rxtx) is recognized. If present, it enables the two additional sub-attributes fw_mpx=capability (forward multiplexing capability, ts, ts_fec, ps, ps_fec, or h221) and bw_mpx=capa- bility. Both are optional. Note that commas must never follow colons or other commas. Also, whitespace is not allowed inside a SAP specification. SAP specifications are case-insensitive. On input, items must be written in exactly the order used in this document. EXAMPLES
blli:l2=iso8802 Classical IP over ATM (RFC1577) bhli:oui=0x0060D7,id=0x01000001,blli:l2=iso8802 Arequipa (RFC2170) blli:l3=tr9577,ipi=snap,oui=0x00A03E,pid=0x0002 LAN Emulation AUTHOR
Werner Almesberger, EPFL LRC <werner.almesberger@lrc.di.epfl.ch> Linux November 6, 1997 SAP(7)
All times are GMT -4. The time now is 11:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy