Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing the rest of line from the second entry of an expression Post 302249071 by roussine on Monday 20th of October 2008 01:05:19 PM
Old 10-20-2008
Quote:
Originally Posted by Franklin52
Assuming you only want to change lines beginning with "Query=":

Code:
sed '/^Query=/s/\([^ ]* [^ ]*\) .*/\1/' file > newfile

Regards
but what if in my strings starting with the "Query=" I wanted to change all spaces into, say, '_' except for the first space in the string (the contents of strings differ except for the marking 'Query=')?
Couldn't figure how to do this with regions..

thanks much for help!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Delete rest of the line

Hi, can anyone please answer my question in deleting the rest of the line. I have an example below of a file contaning: Serial3/1.5 43.70.195.13 YES NVRAM down down Serial3/3 225.94.155.69 YES NVRAM up down Serial3/6 ... (3 Replies)
Discussion started by: Aejaz
3 Replies

2. Shell Programming and Scripting

Maximum value of each line entry

Dear power users, I have a file like this: AA 8 AA 6 AA 5 AA 4 AA 3 BB 9 BB 4 BB 3 BB 2 ZZ 5 ZZ 3 ZZ 1 ... The characters in colum one are variously different until the end of the file. I want to extract the maximum value of each entry in... (3 Replies)
Discussion started by: kecopx
3 Replies

3. Shell Programming and Scripting

Search a string and print the rest of line

Hi Guys, I need to search a string and print the rest of the lines... input: 8 0 90 1 0 59 20 2488 96 30006dde372 S ? 0:00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n output: 00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n Actually i don even need the first "00".. any suggestions is appreciated..... (13 Replies)
Discussion started by: mac4rfree
13 Replies

4. Shell Programming and Scripting

Delete rest of line with sed works on Linux but not on Solaris

Hi all, Our application installation uses "sed" command to delete rest of line. It work perfect on Linux but fail on Solaris. The OS versions are Solaris 9 and Linux Red Hat AS 3. yourfile.txt hello and world cat and dog hello world in linux: cat yourfile.txt | sed ‘s/\(\+\)... (3 Replies)
Discussion started by: javac2005
3 Replies

5. Shell Programming and Scripting

Find and delete rest of the line

i need to find ' - ' in a line , if i found i need to rest of the line including '-' example libmm-2.0 libytytsunos-5.6 output libmm libytytsunos (7 Replies)
Discussion started by: girija
7 Replies

6. Shell Programming and Scripting

How to substitute a line that matches an expression with another line

I need some help. I have a file (all.txt) whereby I want to substitute using sed/awk all lines that matches an expression with another line with different expression i.e subtitute expression, database_id: filename; WITH database_id: PY; There are many occurrences of the expression... (4 Replies)
Discussion started by: aimsoft
4 Replies

7. Shell Programming and Scripting

awk delete/remove rest of line on multiple search pattern

Need to remove rest of line after the equals sign on search pattern from the searchfile. Can anybody help. Couldn't find any similar example in the forum: infile: 64_1535: Delm. = 86 var, aaga 64_1535: Fran. = 57 ex. ccc 64_1639: Feb. = 26 (link). def 64_1817: mar. = 3/4. drz ... (7 Replies)
Discussion started by: sdf
7 Replies

8. UNIX for Dummies Questions & Answers

find string and get the rest of the line in a pipe delimited file

Hi friends, I have a file where I should search for a string and get the rest of the line but without the delimiter using awk. for example I have the series of string in a file: input_string.txt bbb ccc aaa and the mapping file looks like this. mapping.txt aaa|12 bbb|23 ccc|43... (11 Replies)
Discussion started by: kokoro
11 Replies

9. Shell Programming and Scripting

Find the text in the file and delete the rest of the line.

Hi, I have one requiremnet like this. I need to find some particular string (eg.IncludeDateTime = ) in a file. And wherever it finds the string the unix script has to delete the remaining text coming after the string (ie., 'IncludeDateTime = ' ) in the same line. I tried to write this script in... (5 Replies)
Discussion started by: jannusuresh
5 Replies

10. UNIX for Dummies Questions & Answers

Removing rows that contain non-unique column entry

Background: I have a file of thousands of potential SSR primers from Batch Primer 3. I can't use primers that will contain the same sequence ID or sequence as another primer. I have some basic shell scripting skills, but not enough to handle this. What you need to know: I need to remove the... (1 Reply)
Discussion started by: msatseqs
1 Replies
Search::GIN::Query::Set(3pm)				User Contributed Perl Documentation			      Search::GIN::Query::Set(3pm)

NAME
Search::GIN::Query::Set - Create queries with set operations VERSION
version 0.08 SYNOPSIS
# build a query like: # (type:pdf OR type:png) AND (name:Homer OR name:Bart) use Search::GIN::Query::Set; use Search::GIN::Query::Manual; my $query = Search::GIN::Query::Set->new( operation => 'INTERSECT', subqueries => [ Search::GIN::Query::Manual->new( values => { type => [qw(pdf png)] } ), Search::GIN::Query::Manual->new( values => { name => [qw(Homer Bart)] } ), ] ); DESCRIPTION
Creates a manual GIN query that can be used to search using basic set theory, in order to build more complex queries. This query doesn't provide any specific search, it's just a set operator for subqueries. You can build complex queries by using other set queries as subqueries for a set query. METHODS
/SUBROUTINES new Creates a new query. ATTRIBUTES
subqueries The subqueries to process operation One of the basic set operators: "UNION", "INTERSECT" and "EXCEPT". The default is "UNION" AUTHOR
Yuval Kogman <nothingmuch@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Yuval Kogman, Infinity Interactive. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2011-01-31 Search::GIN::Query::Set(3pm)
All times are GMT -4. The time now is 06:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy