Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Answers to Frequently Asked Questions How to prevent sed command removing whole line? Post 302979295 by RudiC on Friday 12th of August 2016 04:15:03 AM
Old 08-12-2016
Slight modification of itkamaraj's fine proposal to yield the full required output:
Code:
echo "a=5; /* this is a comment */" | sed "s;.*\(/\*.*\*/\);\1;"
/* this is a comment */

These 2 Users Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing parts of a line with SED

hi, i'm trying to erase all the characters after, and including, the first test test Output: test1 test2 test3 this is what I tried, but didn't work sed "s/*//" file > testfilename any suggestions? thanks, gammmaman (2 Replies)
Discussion started by: gammaman
2 Replies

2. Shell Programming and Scripting

removing a line containing a pattern in sed

i need to use sed to remove an entire line containing a pattern stored in a variable say $var1 this var1 will be a URL and will therefore contain slashes any help would be greatly appreciated (1 Reply)
Discussion started by: Fire_Storm
1 Replies

3. Shell Programming and Scripting

Sed question (Removing a line of text)

I am working with bash on HP-UX server at school. As practice for scripting, I am trying to make a pretend server admin script that adds a user to the system, deletes a user from the system, and lists all users of the pretend system. I have accomplished this with a select loop. Adding users, and... (2 Replies)
Discussion started by: masterscout1977
2 Replies

4. Shell Programming and Scripting

Loop with sed command to replace line with sed command in it

Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line. ... (1 Reply)
Discussion started by: cbo0485
1 Replies

5. 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

6. Shell Programming and Scripting

sed removing until end of line

All: Can somebody help me out with a sed command, which removes the the first occurance of ')' until the end of the line If I have the following input ... (5 Replies)
Discussion started by: BeefStu
5 Replies

7. UNIX for Dummies Questions & Answers

sed or awk - removing part of line?

hi all, I am having trouble finding the right string for this - I dont know whether to use awk or sed.. If I have a file with alot of names and phone numbers like this McGowan,Sean 978-934-4000 Kilcoyne,Kathleen 603-555-1212 Club603,The 617-505-1332 Boyle,William 301-444-1221 And... (11 Replies)
Discussion started by: alis
11 Replies

8. UNIX for Dummies Questions & Answers

sed command for removing symbols

Hi I am trying to remove all the symbols in a file (testfile1) and using the below command to do that. Its not working for me. Can you help me on what is wrong with below script? I want to retain only alphabets in a file and remove all the symbols like *:.+= etc sed 's/^.//g' testfile1 > testfile2 (4 Replies)
Discussion started by: sandeepcm
4 Replies

9. Shell Programming and Scripting

sed - Removing all characters from token to end of line

Hello. The token is any printable characters between 2 " . The token is unknown, but we know that it is between 2 " Tok 1 : "1234x567" Tok 2 : "A3b6+None" Tok 3 : "A3b6!1234=@" The ligne is : Line 1 : "9876xABCDE"Do you have any code fragments or data samples in your post Line 2 : ... (3 Replies)
Discussion started by: jcdole
3 Replies

10. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies
oggz-comment(1) 					      General Commands Manual						   oggz-comment(1)

NAME
oggz-comment -- List or edit comments in an Ogg file. SYNOPSIS
oggz-comment [-l | --list ] oggz-comment [-o filename | --output filename ] [-d | --delete ] [-a | --all ] [-s serialno | --serialno serialno ] [-c content- type | --content-type content-type ] filename oggz-comment [-h | --help ] [-v | --version ] Description oggz-comment lists or edits the comments of an Ogg file. Options oggz-comment accepts the following options: Listing options -l, --list List the comments in the given file. Editing options -o filename, --output filename Write output to the specified filename. -d, --delete Delete comments before editing. -a, --all Edit comments for all logical bitstreams. -c content-type, --content-type content-type Edit comments of the logical bitstreams with specified content-type. Run oggz-known-codecs(1) for a full list of codecs known by the installed version of oggz. -s serialno, --serialno serialno Edit comments of the logical bitstream with specified serialno. Miscellaneous options -h, --help Display usage information and exit. -v, --version Output version information and exit. EXAMPLES
List all comments in file.ogg: oggz comment -l file.ogg List only the comments in the Theora bitstream in file.ogv: oggz comment -l -c theora file.ogv Add the comment "GENRE=Rock" to the Vorbis bitstream of file.ogv, writing output to output.ogv: oggz comment -c vorbis -o output.ogv file.ogg GENRE=Rock AUTHOR
Kangyuan Niu August 5, 2007; COPYRIGHT
Copyright (C) 2007 Annodex Association SEE ALSO
vorbiscomment(1), ogginfo(1), oggz-info(1), hogg(1) oggz-comment(1)
All times are GMT -4. The time now is 01:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy