Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting a pattern in UNIX without deleting the entire line Post 302770460 by Alyaa on Saturday 16th of February 2013 08:59:28 AM
Old 02-16-2013
U have this file:

>VA3401APNWI length=441 xy=0175_0688 region=1 run=R_2011_01_05_12_50_53_
>VA3401B7HKY length=443 xy=0788_1072 region=1 run=R_2011_01_05_12_50_53_


I want to retain only the pattern from ">" till the "space character" before "length". and discard the rest of the line starting "length till the end of the line.

I then want to append a specific string "AT50" to every line in the file.

I tried sed '/^V[^|][^|]*|/s/|.*//' file and sed '/^>[^|][^|]*|/s/|.*//' file but it doesn;t work. Any help please ?

Thank you very much

---------- Post updated at 08:59 AM ---------- Previous update was at 08:57 AM ----------

I want the output to be like that:

>VA3401APNWI tab AT50
>VA3401B7HKY tab AT50
 

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
shishi_kdcreq_till(3)						      shishi						     shishi_kdcreq_till(3)

NAME
shishi_kdcreq_till - API function SYNOPSIS
#include <shishi.h> int shishi_kdcreq_till(Shishi * handle, Shishi_asn1 kdcreq, char ** till, size_t * tilllen); ARGUMENTS
Shishi * handle Shishi library handle create by shishi_init(). Shishi_asn1 kdcreq KDC-REQ variable to get client name from. char ** till pointer to newly allocated zero terminated string containing "till" field with generalized time. May be NULL (to only populate realmlen). size_t * tilllen pointer to length of till on output, excluding terminating zero. May be NULL (to only populate tilllen). DESCRIPTION
Get "till" field (i.e. "endtime") in KDC-REQ, as zero-terminated string. The string is typically 15 characters long. The string is allo- cated by this function, and it is the responsibility of the caller to deallocate it. Note that the output length realmlen does not include the terminating zero. RETURN VALUE
Returns SHISHI_OK iff successful. REPORTING BUGS
Report bugs to <bug-shishi@gnu.org>. COPYRIGHT
Copyright (C) 2002-2010 Simon Josefsson. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. SEE ALSO
The full documentation for shishi is maintained as a Texinfo manual. If the info and shishi programs are properly installed at your site, the command info shishi should give you access to the complete manual. shishi 1.0.1 shishi_kdcreq_till(3)
All times are GMT -4. The time now is 11:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy