Sponsored Content
Top Forums UNIX for Dummies Questions & Answers SED: How to delete from expression to end of line Post 75394 by rtstanley on Friday 17th of June 2005 02:25:27 PM
Old 06-17-2005
SED: How to delete from expression to end of line

I have the following line(s) of text in a file:

Card: H'00f2 Elapsed Time (day - h:m:s): 0 - 21:14:18.5

I basically want to search for "Elapsed Time", then delete this and everything else to the end of the line. I've tried a lot of different things, but cannot seem to get rid of everything.

Any ideas?

I've tried the following:

(1) sed 's/^M//g;s/Elapsed Time [():a-zA-Z0-9 ]*//'

results: Card: H'00f2 - h:m:s): 0 - 21:14:18.5

(2) sed 's/(day - h:m:s)://g;s/Elapsed Time[ ]*[0-9]*[a-z]*[A-Z]*//'

results: Card: H'00f2 - 21:14:18.5
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed to end of line

I know this is going to be an easy anwer, but I haven't been able to figure this out - even with the help of the previous posts. I want to go from this PROD USER anon; to this TEST; I have coded a few sed commands, and none of them are getting the job done. anon will not always be the... (2 Replies)
Discussion started by: djschmitt
2 Replies

2. Shell Programming and Scripting

awk : delete ^M at the end of the line

Hi all, I'm newbi in scripting. could someone tell how to delete the ^M at the end of the linie with an awk command. many thanks in advance. (2 Replies)
Discussion started by: liliput
2 Replies

3. Shell Programming and Scripting

Sed Help (Using expression - line break)

*Note, I thought I was in Shell Programming and Scripting Q&A and posted in a wrong forum. To avoid confusion and to inform people that I'm not trying to "spam" the forums, I'm adding this note up top* Hi Everyone thanks in advance for any input you can provide on the following question! I'm... (2 Replies)
Discussion started by: Janus
2 Replies

4. Shell Programming and Scripting

delete to end of line with SED

I have a file with a bunch of similar lines in which I want to extract a phrase delimited by the first occurance of a '>' at the beginning and the first occurance of a '<' at the end (you might have guessed these are beginning/end of HTML tags). Using Sed I have managed to delete up to and... (7 Replies)
Discussion started by: coldcanuck
7 Replies

5. Shell Programming and Scripting

Urgent! Sed/Awk Filter Find Pattern Delete Till End Of Line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (2 Replies)
Discussion started by: rajan_san
2 Replies

6. UNIX for Advanced & Expert Users

Urgent Help required : awk/sed help to find pattern and delete till end of line

Hi, I need help with using an awk or sed filter on the below line ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE Look for... (1 Reply)
Discussion started by: rajan_san
1 Replies

7. Shell Programming and Scripting

delete to end of formatted warnings using sed or cut...

hi, i've searched the forums' entries and have tried some of the examples -- to no avial -- this is my first post -- thanks in advance for your help... As part of an installation program -- i'm receiving two(2) extraneous "libcxb WARNING!" statements -- i want to use sed to eliminate the... (12 Replies)
Discussion started by: rickkar
12 Replies

8. UNIX for Dummies Questions & Answers

Removing end of line using SED

Hello Friends, How can I remove the last two values of this line using sed John Carey:507-699-5368:29 Albert way, Edmonton, AL 25638:9/3/90:45900 The result should look like this: John Carey:507-699-5368:29 Albert way, Edmonton, AL 25638 (3 Replies)
Discussion started by: humkhn
3 Replies

9. UNIX for Dummies Questions & Answers

delete trailing whitespace from end of each line in column 1 only

Hi All. How can I convert this: ABC_1_1 ABC_1_2 ABC_1_3 into this: ABC_1 1 ABC_1 2 ABC_1 3 I tried this command but it is not working: awk '{sub(/+$/,"\t", $1)}{print}' Any suggestions on how to fix this? Thank you :wall: Please use code tags when posting data and... (3 Replies)
Discussion started by: danieladna
3 Replies

10. Shell Programming and Scripting

Delete lines that contain a pattern from specific line to the end.

Gents, I am trying to delete all lines which start with "H" character, but keeping the fist header. Example In the input file I will delete all lines starting from line 8 which contents character "H" to the end of the file. I try sed '8,10000{/^H/d;}' file But as don't know the end... (1 Reply)
Discussion started by: jiam912
1 Replies
PCCARD(4)						   BSD Kernel Interfaces Manual 						 PCCARD(4)

NAME
pccard -- PC Card bus driver SYNOPSIS
device pccard DESCRIPTION
The pccard driver implements the PC Card bus. The pccard driver supports all PC Card bridges in the system. TUNABLES
The driver supports the following tunable parameters, which may be added to /boot/loader.conf or set via the sysctl(8) command: hw.pccard.debug Non-zero values cause more verbose information to be printed when a 16-bit PC Card is inserted or removed. hw.pccard.cis_debug Non-zero value causes the CIS parsing of the 16-bit PC Card to be much more verbose and include a complete CIS dump. FILES
/dev/pccard0.cis This exclusive-use device will report all the CIS chains present in a PC Card, if a 16-bit PC Card is inserted in the slot. Only one user at a time may access the CIS. The CIS is presented as the relevant byte stream from the PC Card. For CIS tuples in Attribute Memory (the default), only the even locations are presented (the ODD locations are undefined per the standard). For CIS tuples in Common Memory, every byte is presented to the user. Decoding of the CIS tuples is done via a userland program. All tuples are presented to the user. SEE ALSO
cardbus(4), pccbb(4) PC Card Standard, Release 8. BSD
July 9, 2002 BSD
All times are GMT -4. The time now is 02:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy