Sponsored Content
Top Forums Shell Programming and Scripting Grep and neglect a specific string Post 303015670 by RudiC on Tuesday 10th of April 2018 04:13:44 AM
Old 04-10-2018
It is usually best and most efficient for all parties to carefully phrase the request in the first place, cogitating all the possible ramifications e.g. difference in structures and positions in files. Better than letting drip in information droplet by droplet after a solution was found for the first but non-fitting sample.

The easiest way would be to force the long lines into several independent ones:
Code:
tr ' ' '\n' < file | sed ...

The logics lie in the regex: find a string of zero or more colons (parenthesized for later "back reference") then any number of non-colons, the "hope" string, non-colons again, and finally zero or more colons. Replace by the first colon if exists else the empty string (i.e. remove)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep - searching for a specific string

ppl, this is my "file" with fields orderno orderdate orderdesc telno street city 1 01/04/2006 abc 123 100 tampa 2 01/04/2006 abc 123 100 tampa 3 01/04/2006 abc 123 100 tampa 4 01/04/2006 abc ... (2 Replies)
Discussion started by: manthasirisha
2 Replies

2. Shell Programming and Scripting

How To Neglect Delimiter

Hi all Iam having a text file of records seperated by "SPACE" and another text File of Records seperated by "TAB" i'm writing a Generic code for Extracting Duplicate Records Iam using "cut" Command to extract data. How Can I Neglect Delimiter And write a generic code for all cases ... (4 Replies)
Discussion started by: G.Aavudai
4 Replies

3. Shell Programming and Scripting

Remove a specific line from grep output string

Dear All I want to search string "1000" from input file and if it found i want remove line that contain 1000 and also remove 3 line above it and 2 line below it. INPUT FILE: BHAT-D 2 aaa ID CODE GS UPDATE MODE LANG MCO MCL NUMPAGES 50 ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

4. Programming

How to grep the specific string or user's list from the file

I have a file on UNIX system from where I want to grep the list of all users associated to the particular repository.If the user's list is in single line then I fetch all list but if it is in two separate lines it doesn't.I use the below command a=KESTREL-DEV;b=users;cat access_file|grep... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

5. UNIX for Dummies Questions & Answers

Grep Specific String In CSV

Hi All, I have a csv file like the following: "ABCD2","EFGH2","XXXX","1" "ABCD2","EFGH2","XXXX","2" I want to grep out the row which contains the value of 2 within the 4th column, so then i can use the extracted record to cut up and store into numerous variables. Obviously when... (3 Replies)
Discussion started by: RichZR
3 Replies

6. UNIX for Dummies Questions & Answers

How to grep cells that contain a specific string?

How do you grep cells that contain a specific string. I tried grep but it greps the whole line and not just the cells. Thanks! (4 Replies)
Discussion started by: evelibertine
4 Replies

7. UNIX for Dummies Questions & Answers

Grep contains specific string

i have file input dsgfdgdfgd> cab |egrep -i '(active|cbu)' 130502-11:34:11 10.133.1.153 9.0j stopfile=/tmp/15959 Trying password from ipdatabase file: /opt/ericsson/amos/moshell/sitefiles/ipdatabase... .. 0 1 CBU1 OFF ON 16HZ ROJ1192209/1 R5E TU8BZ04466... (3 Replies)
Discussion started by: radius
3 Replies

8. Shell Programming and Scripting

Grep string in a file and paste next line in a specific way

Hello, I know there are many questions and replies regarding grep command. What I would like to do is a bit different. File A: hello world welcome to my page this is my test site how are you I am fine, thank you where have you been I was in hospital really hope you are fine now Thanks,... (10 Replies)
Discussion started by: baris35
10 Replies

9. Shell Programming and Scripting

Grep only words containing specific string

Hello, I have two files. All urls are space seperated. source http://xx.yy.zz http://df.ss.sd.xz http://09.09.090.01 http://11.22.33 http://canada.xx.yy http://01.02.03.04 http://33.44.55 http://98.87.76.65 http://russia.xx.zz http://aa.tt.xx.zz http://1w.2e.3r.4t http://china.rr.tt ... (4 Replies)
Discussion started by: baris35
4 Replies

10. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies
deb-version(5)							      Debian							    deb-version(5)

NAME
deb-version - Debian package version number format SYNOPSIS
[epoch:]upstream-version[-debian-revision] DESCRIPTION
Version numbers as used for Debian binary and source packages consist of three components. These are: epoch This is a single (generally small) unsigned integer. It may be omitted, in which case zero is assumed. If it is omitted then the upstream-version may not contain any colons. It is provided to allow mistakes in the version numbers of older versions of a package, and also a package's previous version num- bering schemes, to be left behind. upstream-version This is the main part of the version number. It is usually the version number of the original ("upstream") package from which the .deb file has been made, if this is applicable. Usually this will be in the same format as that specified by the upstream author(s); however, it may need to be reformatted to fit into the package management system's format and comparison scheme. The comparison behavior of the package management system with respect to the upstream-version is described below. The upstream-ver- sion portion of the version number is mandatory. The upstream-version may contain only alphanumerics ("A-Za-z0-9") and the characters . + - : ~ (full stop, plus, hyphen, colon, tilde) and should start with a digit. If there is no debian-revision then hyphens are not allowed; if there is no epoch then colons are not allowed. debian-revision This part of the version number specifies the version of the Debian package based on the upstream version. It may contain only alphanumerics and the characters + . ~ (plus, full stop, tilde) and is compared in the same way as the upstream-version is. It is optional; if it isn't present then the upstream-version may not contain a hyphen. This format represents the case where a piece of software was written specifically to be turned into a Debian package, and so there is only one "debianisation" of it and therefore no revision indication is required. It is conventional to restart the debian-revision at '1' each time time the upstream-version is increased. Dpkg will break the version number apart at the last hyphen in the string (if there is one) to determine the upstream-version and debian-revision. The absence of a debian-revision compares earlier than the presence of one (but note that the debian-revision is the least significant part of the version number). Sorting Algorithm The upstream-version and debian-revision parts are compared by the package management system using the same algorithm: The strings are compared from left to right. First the initial part of each string consisting entirely of non-digit characters is determined. These two parts (one of which may be empty) are compared lexically. If a difference is found it is returned. The lexical comparison is a comparison of ASCII values modified so that all the letters sort earlier than all the non-letters and so that a tilde sorts before anything, even the end of a part. For exam- ple, the following parts are in sorted order: '~~', '~~a', '~', the empty part, 'a'. Then the initial part of the remainder of each string which consists entirely of digit characters is determined. The numerical values of these two parts are compared, and any difference found is returned as the result of the comparison. For these purposes an empty string (which can only occur at the end of one or both version strings being compared) counts as zero. These two steps (comparing and removing initial non-digit strings and initial digit strings) are repeated until a difference is found or both strings are exhausted. Note that the purpose of epochs is to allow us to leave behind mistakes in version numbering, and to cope with situations where the version numbering scheme changes. It is not intended to cope with version numbers containing strings of letters which the package management sys- tem cannot interpret (such as 'ALPHA' or 'pre-'), or with silly orderings. CAVEATS
The tilde character and its special sorting properties were introduced in dpkg, version 1.10 and some parts of dpkg-dev only gained support for it later in the 1.10.x series. SEE ALSO
deb-control(5), deb(5), dpkg(1) Debian Project 2011-08-14 deb-version(5)
All times are GMT -4. The time now is 02:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy