Sponsored Content
Top Forums Shell Programming and Scripting A way to delete specific lines Post 302472277 by Scott on Tuesday 16th of November 2010 05:21:42 PM
Old 11-16-2010
Your question is somewhat vague. Not all of the lines you print are of the same length:
Code:
$ awk '{print length}' file1
136
136
99
99
99
136
135
99
99
136
$ awk 'length == 136' file1               
"2010-07-26","2010","07","26","*","26.90","","13.10","","20.00","","0.00","","2.00","","","M","","M","0.60","","","","0.00","","0.00",""
"2010-07-27","2010","07","27","*","26.80","","15.30","","21.10","","0.00","","3.10","","","M","","M","0.90","","","","0.00","","0.00",""
"2010-07-31","2010","08","06","*","25.40","","12.20","","18.80","","0.00","","0.80","","","M","","M","0.00","","","","0.00","","0.00",""
"2010-08-04","2010","07","28","*","30.10","E","17.30","E","23.70","E","0.00","E","5.70","E","","M","","M","6.90","E","","","","M","","M"

136, as far as fixed-length, gives the closest match.

Last edited by Scott; 11-16-2010 at 06:32 PM.. Reason: Wording
 

10 More Discussions You Might Find Interesting

1. Programming

Delete specific lines in a text file

Hi, experts, I would like to create a function that can calculate the total number of lines in a saved text file and delete specific lines in that particular file (I only want the last few lines). Hav anybody have the experience and giv me a hand in this? (9 Replies)
Discussion started by: dniz
9 Replies

2. UNIX for Advanced & Expert Users

How to delete specific lines at the same time

Dear All I have a pattern which look like this: 2 20080312_10:55:35.800 Spain-Telefonica ISC 9 IAM 927535957 34670505334 f 275 COT b 700 ACM b 6577 CPG b 10726 ANM b 202195 REL f 202307 RLC :COMMA: NCI=15,FCI=2101,CPC=0A,TMR=00,USI,OFI=00: :COMMB: BCI=0214,OBI=01,ACT: :RELCAUSE:10: This... (1 Reply)
Discussion started by: zanetti321
1 Replies

3. Shell Programming and Scripting

delete lines containing a specific word in afile

Hi, Please suggest how to write a shell script which delets all the lines containing the word unix in the files supplied as argument in the shell. (4 Replies)
Discussion started by: sireesha9
4 Replies

4. Shell Programming and Scripting

Delete specific lines from a file

Hi, I have a file ( all_users.ldif ) of the following format: cn=orcladmin, cn=Users, dc=maximus,dc=com cn=PUBLIC, cn=Users, dc=maximus,dc=com cn=portal,cn=users,dc=maximus,dc=com cn=portal_admin,cn=users,dc=maximus,dc=com cn=uddi_publisher,cn=Users,dc=maximus,dc=com... (4 Replies)
Discussion started by: itzz.me
4 Replies

5. Shell Programming and Scripting

How to delete all lines before a specific word?

Let's say we have a file containing: alllllsadfsdasdf qwdDDDaassss ccxxcxc#2222 dssSSSSddDDDD D1Sqn2NYOHgTI Hello Alex ssS@3 Ok, and let's say we want to delete all words from D1Sqn2NYOHgTI and back, this means to delete the words (and the lines of them) : alllllsadfsdasdf... (2 Replies)
Discussion started by: hakermania
2 Replies

6. Shell Programming and Scripting

Delete all lines after a specific line ?

Hello. My file is like this: a b c d e f g h i I want to delete all lines after the 3rd line, means after the "c". Is there any way to do this? The lines differ between them and the lines I want to delete does not have a specific word, or the lines I want to keep (a,b,c) does not have a... (4 Replies)
Discussion started by: hakermania
4 Replies

7. Shell Programming and Scripting

Delete multiple lines starting with a specific pattern

Hi, just tried some script, awk, sed for the last 2 hours and now need help. Let's say I have a huge file of 800,000 lines like this : It's a tedious job to look through it, I'd like to remove those useless lines in it as there's a few thousands : Or to be even more precise : if line1 =... (6 Replies)
Discussion started by: Zurd
6 Replies

8. UNIX for Dummies Questions & Answers

How to delete specific lines (2n+3 line, n=0,1,2...296) in a file?

Dear everyone, I have a file with 900 lines (there is only numbers in one line, no string), I only need the lines 2+3n (n=0,1...296), i.e line 2, 5, 8, 11...888. I tried google but only the results such as how to delete all the odd lines or all the even lines with 'awk' command. Thanks in... (4 Replies)
Discussion started by: phamnu
4 Replies

9. Shell Programming and Scripting

How to delete lines starting with specific string?

Dear all, I would like to delete even lines starting with "N" together with their respective titles which are actually odd lines. Below is the example of input file. I would like to remove line 8 and 12 together with its title line, i.e., line 7 and 11, respectively.... (2 Replies)
Discussion started by: huiyee1
2 Replies

10. Shell Programming and Scripting

Delete lines above and below specific line of text

I'm trying to remove a specific number of lines, above and below a specific line of text, highlighted in red: <STMTTRN> <TRNTYPE>CREDIT <DTPOSTED>20151205000001 <TRNAMT>10 <FITID>667800001 <CHECKNUM>667800001 <MEMO>BALANCE </STMTTRN> <STMTTRN> <TRNTYPE>DEBIT <DTPOSTED>20151207000001... (8 Replies)
Discussion started by: bomsom
8 Replies
UDPLITE(7)						     Linux Programmer's Manual							UDPLITE(7)

NAME
udplite - Lightweight User Datagram Protocol SYNOPSIS
#include <sys/socket.h> sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDPLITE); DESCRIPTION
This is an implementation of the Lightweight User Datagram Protocol (UDP-Lite), as described in RFC 3828. UDP-Lite is an extension of UDP (RFC 768) to support variable-length checksums. This has advantages for some types of multimedia transport that may be able to make use of slightly damaged datagrams, rather than having them discarded by lower-layer protocols. The variable-length checksum coverage is set via a setsockopt(2) option. If this option is not set, the only difference to UDP is in using a different IP protocol identifier (IANA number 136). The UDP-Lite implementation is a full extension of udp(7), i.e., it shares the same API and API behaviour, and in addition offers two socket options to control the checksum coverage. Address Format UDP-Litev4 uses the sockaddr_in address format described in ip(7). UDP-Litev6 uses the sockaddr_in6 address format described in ipv6(7). Socket Options To set or get a UDP-Lite socket option, call getsockopt(2) to read or setsockopt(2) to write the option with the option level argument set to IPPROTO_UDPLITE. In addition, all IPPROTO_UDP socket options are valid on a UDP-Lite socket. See udp(7) for more information. The following two options are specific to UDP-Lite. UDPLITE_SEND_CSCOV This option sets the sender checksum coverage and takes an int as argument, with a checksum coverage value in the range 0..2^16-1. A value of 0 means that the entire datagram is always covered. Values from 1-7 are illegal (RFC 3828, 3.1) and are rounded up to the minimum coverage of 8. With regard to IPv6 jumbograms (RFC 2675), the UDP-Litev6 checksum coverage is limited to the first 2^16-1 octets, as per RFC 3828, 3.5. Higher values are therefore silently truncated to 2^16-1. If in doubt, the current coverage value can always be queried using getsockopt(2). UDPLITE_RECV_CSCOV This is the receiver-side analogue and uses the same argument format and value range as UDPLITE_SEND_CSCOV. This option is not required to enable traffic with partial checksum coverage. Its function is that of a traffic filter: when enabled, it instructs the kernel to drop all packets which have a coverage less than the specified coverage value. When the value of UDPLITE_RECV_CSCOV exceeds the actual packet coverage, incoming packets are silently dropped, but may generate a warning message in the system log. ERRORS
All errors documented for udp(7) may be returned. UDP-Lite does not add further errors. BUGS
Where glibc support is missing, the following definitions are needed: #define IPPROTO_UDPLITE 136 #define UDPLITE_SEND_CSCOV 10 #define UDPLITE_RECV_CSCOV 11 FILES
/proc/net/snmp - basic UDP-Litev4 statistics counters. /proc/net/snmp6 - basic UDP-Litev6 statistics counters. VERSIONS
UDP-Litev4/v6 first appeared in Linux 2.6.20. SEE ALSO
udp(7), ip(7), ipv6(7), socket(7) RFC 3828 for the Lightweight User Datagram Protocol (UDP-Lite) Documentation/networking/udplite.txt COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-12-03 UDPLITE(7)
All times are GMT -4. The time now is 08:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy