Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting a pattern in UNIX without deleting the entire line Post 302761849 by Alyaa on Sunday 27th of January 2013 08:57:36 AM
Old 01-27-2013
Deleting a pattern in UNIX without deleting the entire line

Hi

I have a file:

Code:
r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e)

I want to retain only r58778.3 and delete the remaining of the entire line so that the new file would be:
Code:
r58778.3

any help, I tried
Code:
sed 's/|SOURCES*//'

but its not the correct command in this case, any advise ?

thanks a lot
Alyaa

Last edited by Scrutinizer; 01-27-2013 at 10:18 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Deleting UNIX End of Line Chachracter \000

Hi, I have this file which has some octal NULL characters (\000). I need to replace these characters with an ASCII NULL. I've tried using Perl, the UNIX tr command.. History of this I received a COBOL generated file, ran the od command to convert to a xxx byte per record file. Now,... (3 Replies)
Discussion started by: uchachra
3 Replies

2. Shell Programming and Scripting

prom in deleting a pattern

hi guys, i have a directory.inside that so many directories and files are there.i want to search the complete directory for a pattern in all the .txt files.if i will find that pattern then i want to delete that pattern from that file. please help me out. i want it urgent (18 Replies)
Discussion started by: suvendu4urs
18 Replies

3. Shell Programming and Scripting

deleting lines after pattern using sed

I have seen there are many sed posts but still it is quite difficult to apply other post to my own problem How can I delete all lines in a file from 2 lines after this pattern *End_fine_coreg:_NORMAL to the end of file? Cheers (2 Replies)
Discussion started by: larne
2 Replies

4. Shell Programming and Scripting

deleting a pattern from a file

say i have a file with the following contents 0x20 0x20 0xc23886 > 0xc12354 > 0xc567555555 i want to delete "> " pattern and keep the rest of the file (6 Replies)
Discussion started by: lassimanji
6 Replies

5. Shell Programming and Scripting

Searching a pattern in file and deleting th ewhole line containing the pattern

Hi All, Please can someone assist in the script I have made that searches a pattern in a file and delete the whole line containing the pattern. #!bin/sh # The pattern that user want to add to the files echo "Enter the pattern of the redirect" read value # check if the user has... (1 Reply)
Discussion started by: Shazin
1 Replies

6. Shell Programming and Scripting

sed: deleting 5 lines after a specified pattern

As an example (just an example, this could apply to any block of text) say I have this: architecture x86_64 cputype CPU_TYPE_X86_64 cpusubtype CPU_SUBTYPE_X86_64_ALL offset 4096 size 2972420 align 2^12 (4096) architecture ppc64 cputype CPU_TYPE_POWERPC64 cpusubtype... (3 Replies)
Discussion started by: pcwiz
3 Replies

7. Shell Programming and Scripting

Deleting pattern without removing line

I am trying to delete a pattern without removing line. I searched a lot in this forum and using those I could come up with sed command but it seems that command does not work. Here's how my file looks like: 1 ./63990 7 1171 ./63990 2 2425 ./63990 9 2539 ./63990 1 3125 ./63990 1 10141... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

8. Shell Programming and Scripting

retaining only the second line with a pattern and deleting all others

Hi, I have a file: 5 T1AxialPremosaic ok 512 448 23 1 284000-000005-000001.dcm 6 T2_SPACE ok 256 256 176 1 465000-000006-000001.dcm 7 FLAIRmosaic ok 512 432 23 1 748000-000007-000001.dcm 8 T2_SPACE ok 256 256 1 171000-000008-000001.dcm 9 T2_SPACE ok 256 256 1 218000-000009-000001.dcm... (5 Replies)
Discussion started by: goodbenito
5 Replies

9. Shell Programming and Scripting

Help with a deleting lines based on a pattern

I have a header-detail file that goes like this: SHP00288820131021110921 ORDER0156605920131021110921INMMMMFN DETAIL0004 4C2Z 10769 AAFC 0000009600000094 4C2Z 10769 AAFC 0000672107 OIL DETAIL0002 ER3Z 14300 E 0000001300000012 ER3Z 14300 E 0000672107 OIL... (3 Replies)
Discussion started by: rbaggio666
3 Replies

10. Shell Programming and Scripting

Deleting lines on matching certain pattern

hi I have a large xml file from which i have taken few lines . In this file I have to find for the string </invoices> and check if the 3 rd line after this string does not begin with <portCode> ,then i have to delete the string </invoices> and the next line having the string </shippingBill>... (13 Replies)
Discussion started by: sunnyboy
13 Replies
Locale::Codes::LangExt(3)				User Contributed Perl Documentation				 Locale::Codes::LangExt(3)

NAME
Locale::Codes::LangExt - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangExt; $lext = code2langext('acm'); # $lext gets 'Mesopotamian Arabic' $code = langext2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langext_codes(); @names = all_langext_names(); DESCRIPTION
The "Locale::Codes::LangExt" module provides access to standard codes used for identifying language extensions, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language extensions. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langext('acm','alpha'); $lext = code2langext('acm',LOCALE_LANGEXT_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from the IANA language registry, such as 'acm' for Mesopotamian Arabic. This is the default code set. ROUTINES
code2langext ( CODE [,CODESET] ) langext2code ( NAME [,CODESET] ) langext_code2code ( CODE ,CODESET ,CODESET2 ) all_langext_codes ( [CODESET] ) all_langext_names ( [CODESET] ) Locale::Codes::LangExt::rename_langext ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangExt::add_langext ( CODE ,NAME [,CODESET] ) Locale::Codes::LangExt::delete_langext ( CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_alias ( NAME ,NEW_NAME ) Locale::Codes::LangExt::delete_langext_alias ( NAME ) Locale::Codes::LangExt::rename_langext_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::add_langext_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangExt::delete_langext_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-02-27 Locale::Codes::LangExt(3)
All times are GMT -4. The time now is 07:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy