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
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 01:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy