Sponsored Content
Full Discussion: Selective replace and delete
Top Forums UNIX for Dummies Questions & Answers Selective replace and delete Post 302958047 by sonia102 on Sunday 18th of October 2015 11:11:19 PM
Old 10-19-2015
Selective replace and delete

Hi
My input file looks like this:
Code:
>BAHMI01000090.1 Details of the shopping list  9800 item00090, whole set of listed artifacts and objects
>BAHMI01050012.1 Details of the shopping list  9800 item02310, whole set of listed artifacts and objects
>BAHMI01070078.1 Details of the shopping list  9800 item03340, whole set of listed artifacts and objects
>BAHMI01070121.1 Details of the shopping list  9800 item10010, whole set of listed artifacts and objects
>BAHMI01080450.1 Details of the shopping list  9800 item19000, whole set of listed artifacts and objects

Requird output:
Code:
>product00090
>product02310
>product03340
>product10010
>product19000

I tried doing this in 2 steps :

step 1 : using

Code:
sed 's/BAHMI01* Details of the shopping list  9800 item/product/g' inputfile> outputfile

I was expecting a result like

Code:
>product00090, whole set of listed artifacts and objects
>product02310, whole set of listed artifacts and objects
>product03340, whole set of listed artifacts and objects
>product10010, whole set of listed artifacts and objects
>product19000, whole set of listed artifacts and objects

But it didnt work.


Step2 was to use :

Code:
awk '/^>product/ {$0=$1}1' outputfile> outputfile2

But both my commands didn't yield required result

Could someone suggest?
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Trying to delete a directory pattern-selective deletion

Trying to delete a directory or a file using a pattern-selective deletion (using “*” and “?” ) (4 Replies)
Discussion started by: herberwz
4 Replies

2. Shell Programming and Scripting

replace/delete odd occurance

how to delete/replace the the odd occurance of a pattern say newline character "\n" a,b,c,d e,f g, h, i, j, k, l m,n 1, 2, 3, 4, 5, 6 1, 3, 4, 5, 6, 7 the output should be a,b,c,de,f g, h, i, j, k, lm,n 1, 2, 3, 4,5, 6 1, 3, 4, 5, 6, 7 (4 Replies)
Discussion started by: ratheeshjulk
4 Replies

3. Shell Programming and Scripting

RegEx - selective delete around a pattern

I need RegEx to delete text block delimited by "^--" and "^request saved" if the block contained the pattern "FAILED:No air,rail,hotel or car" in the following. Many thanks in advance! company_id=9292 queue_id=72 internationalOnly=0 Building XML... ABC123 Adding passenger first=First ... (1 Reply)
Discussion started by: roshansharma
1 Replies

4. UNIX for Dummies Questions & Answers

Selective Replacements: Using sed or awk to replace letters with numbers in a very specific way

Hello all. I am a beginner UNIX user who is using UNIX to work on a bioinformatics project for my university. I have a bit of a complicated issue in trying to use sed (or awk) to "find and replace" bases (letters) in a genetics data spreadsheet (converted to a text file, can be either... (3 Replies)
Discussion started by: Mince
3 Replies

5. Shell Programming and Scripting

Script to replace/delete lines in C program

I am under the gun on a project and am not very good at scripting. I have to make a modification to thousands of C programs to basically replace the #pragma statement. I don't want to have to do it manually. Here is an example of what I need done. Any help would be greatly appreciated. I... (5 Replies)
Discussion started by: jclanc8
5 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Selective delete command

Hi All. I didnt know how to put this question as but i want to delete my values following string_X but need to retain the data in it. I hope the following might help me in conveying my doubt. My sequence looks like this. >string_1 CAJW010000001... (3 Replies)
Discussion started by: sonia102
3 Replies

7. UNIX for Dummies Questions & Answers

Selective replace

i have a large sequence of format sat_1_g3_g_0_8540 . A 1 15501 . . . ID=sat_1_g3_g_0_8540;parentName=sat_1_g3_g_0_8540;Al=sat_1_g2_g_0_8540; sat_1_g3_g_2_8510 . C 1 25501 . . . ... (11 Replies)
Discussion started by: siya@
11 Replies

8. UNIX for Dummies Questions & Answers

Selective delete in SQL

Hi All This might be a weird query but its related to deleting specific details in database. Bascially I had built a database using a set of files seq1 of 300 mb seq2 of 200 mb seq3 of 350 mb seq4 of 300 mb and after building the database i realized that i didn't need the whole data.... (6 Replies)
Discussion started by: sonia102
6 Replies

9. Shell Programming and Scripting

Selective Replace awk column values

Hi, I have the following data: 2860377|"DATA1"|"DATA2"|"65343"|"DATA2"|"DATA4"|"11"|"DATA5"|"DATA6"|"65343"|"DATA7"|"0"|"8"|"1"|"NEGATIVE" 32340377|"DATA1"|"DATA2"|"65343"|"DATA2"|"DATA4"|"11"|"DATA5"|"DATA6"|"65343"|"DATA7"|"0"|"8"|"1"|"NEG-DID"... (3 Replies)
Discussion started by: sdohn
3 Replies

10. UNIX for Dummies Questions & Answers

SQL selective replace

Hi I have a table which looks like this id | name | length | clone | null 1 | string 1 | 12345643 | string 1 | NULL | 2 | string 2 | 2345612 | string 2 | NULL | 3 | string 3 | 3421556 | string 3 | NULL | 4 | string 4 | 1236742 | string 4 | NULL | 5 | string 5 | 2312677 | string 5 | NULL |... (2 Replies)
Discussion started by: rsi.245
2 Replies
MVN_ALIAS(7)							Java Packages Tools						      MVN_ALIAS(7)

NAME
mvn_alias - add alias(es) for Maven artifact(s) SYNOPSIS
%mvn_alias artifact-coordinates alias [alias ...] DESCRIPTION
mvn_alias macro causes instructions for artifact installation to be added to XMvn reactor configuration. It is used to specify alternative names (aliases) for Maven artifacts. Specified artifact coordinates must match at least one artifact. If not then behavior is unspecified. It is possible to specify artifact coordinates matching multiple artifacts, so one call to mvn_alias can affect installation of more than one artifact. OPERANDS
artifact-coordinates Artifact coordinates specify artifact(s) that this rule applies to. Coordinates are in format groupId:artifactId[:extension[:classifier]][:version]. If extension is specified then version must be specified too. If any part is omitted or equal to empty string then it matches any string. Wildcards and brace expansions are supported in each part. For more information see XMvn Configuration Reference. alias Coordinates specifying artifact alias (alternative name under which matching artifacts will be available). Coordinates are in format groupId:artifactId[:extension[:classifier]][:version]. If extension is specified then version must be specified too. If any part is omitted or equal to empty string then corresponding part from artifact-coordinates will be substituted. Backreferences are supported in form @n, where n is an integer corresponding to brace in artifact-coordinates. AUTHOR
Originally written by Mikolaj Izdebski. Versions 3.0.0 and later were written by Stanislav Ochotnicky. REPORTING BUGS
Bugs should be reported through Red Hat Bugzilla at http://bugzilla.redhat.com/. SEE ALSO
mvn_build(7), mvn_compat_version(7), mvn_config(7), mvn_file(7), mvn_package(7), xmvn(1). JAVAPACKAGES
06/10/2014 MVN_ALIAS(7)
All times are GMT -4. The time now is 09:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy