Sponsored Content
Top Forums Shell Programming and Scripting sed: remove first character from particular line Post 302317502 by hkansal on Tuesday 19th of May 2009 07:04:23 AM
Old 05-19-2009
sed: remove first character from particular line

Hello Experts,

I have a file "tt.txt" which is like:
Code:
#a1=a2
b1=b2
#c1=c2

I need to remove the pound (#) sign from a particular line. In this case let us assume it's 3rd line : "#c1=c2"

I can do it through:
Code:
sed "s/#c1=c2/c1=c2/" tt.txt

but it is possible that I may not know the value "c2" due to which I would not be able to use the above command.

Please point me in the right direction.

Thank You.

Regards,
HKansal
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove Last Character of Line

Hi, I need to put the single line contents of a file into a variable, but remove the last character, for example the file would have this sort of contents: 2;4;3;10;67;54;96; And I want the variable to be: 2;4;3;10;67;54;96 (notice the last ";" has gone). Unfortunately I can't just... (4 Replies)
Discussion started by: danhodges99
4 Replies

2. Shell Programming and Scripting

sed to remove character ['

I have a huge file where the each column has data in the format: . I want to remove the from each value. How do I do it with sed? thanks (2 Replies)
Discussion started by: manishabh
2 Replies

3. Shell Programming and Scripting

How to remove space in sed for / character

Hi... i need a script to remove the space before and after the operator like( / ). Ex : Input file apple / manago mango / fresh apple / fresh Desired output: apple/manago mango/fresh apple/fresh Note: betwee the desired operator space should be removed, between words do not remove... (3 Replies)
Discussion started by: vasanth_vadalur
3 Replies

4. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

5. Shell Programming and Scripting

Need to remove a character using sed

Hi All, I have output like this below ldprod/03 ldprod/02 ldprod/01 ldprod/00 ldnprod/ ldnprod/030 I want only remove all character including / ldprod ldprod ldprod ldprod ldprod ldnprod (8 Replies)
Discussion started by: ranjancom2000
8 Replies

6. UNIX for Dummies Questions & Answers

Remove last character in each line

Hi guys, Does anyone know how to remove the last character in each of the line? This is what I have: ABCDE.1 GLSJD.2 HIJPL.2 HKAGB.3 IUBWQ.1 What I want (remove the dot and number): ABCDE GLSJD HIJPL HKAGB IUBWQ I tried to use this: sed 's/.*//' But I'm not sure if that is... (3 Replies)
Discussion started by: narachaid
3 Replies

7. Shell Programming and Scripting

Sed: delete on each line before a character and after a character

Hi there, A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis). The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies

8. Shell Programming and Scripting

Want to remove / and character using awk or sed

Below i am trying to remove "/" and "r" from the output, so i need output as: hdiskpower3 hdisk0 hdisk1 #inq | grep 5773 | awk '{print $1}' | sed 's/dev//g' | awk -F"/" '{$1=$1}1' .....................................................//rhdiskpower0 //rhdiskpower1 //rhdiskpower2... (3 Replies)
Discussion started by: aix_admin_007
3 Replies

9. Shell Programming and Scripting

sed - remove begin of line up to the third and including occurence of character

hello. How to remove all characters in a line from first character ( a $ ) until and including the third occurrence of that character ( $ ). Any help is welcome. (10 Replies)
Discussion started by: jcdole
10 Replies

10. Shell Programming and Scripting

Need to remove first and last character using sed

Hi I have file in below format. How i can remove the first and lost comma from this below file ,001E:001F,,,02EE,0FED:0FEF, I need output has below 001E:001F,,,02EE,0FED:0FEF (6 Replies)
Discussion started by: ranjancom2000
6 Replies
htmlstrip(3)							     EN Tools							      htmlstrip(3)

NAME
htmlstrip - Strip HTML markup code SYNOPSIS
htmlstrip [-o outputfile] [-O level] [-b blocksize] [-v] [inputfile] DESCRIPTION
HTMLstrip reads inputfile or from "stdin" and strips the contained HTML markup. Use this program to shrink and compactify your HTML files in a safe way. Recognized Content Types There are three disjunct types of content which are recognized by HTMLstrip while parsing: HTML Tag (tag) This is just a single HTML tag, i.e. a string beginning with a opening angle bracket directly followed by an identifier, optionally followed by attributes and ending with a closing angle bracket. Preformatted (pre) This is any contents enclosed in one of the following container tags: 1. <nostrip> 2. <pre> 3. <xmp> The non-HTML-3.2-conforming "<nostrip>" tag is special here: It acts like "<pre>" as a protection container for HTMLstrip but is also stripped from the output. Use this as a pseudo-block which just preserves its body for the HTMLstrip processing but itself is removed from the output. Plain Text (txt) This is anything not falling into one of the two other categories, i.e any content both outside of preformatted areas and outside of HTML tags. Supported Stripping Levels The amount of stripping can be controlled by a optimization level, specified via option -O (see below). Higher levels also include all of the lower levels. The following stripping is done on each level: Level 0: No real stripping, just removing the sharp/comment-lines ("#...") [txt,tag]. Such lines are a standard feature of WML, so this is always done. Level 1: Minimal stripping: Same as level 0 plus stripping of blank and empty lines [txt]. Level 2: Good stripping: Same as level 1 plus compression of multiple whitespaces (more then one in sequence) to single whitespaces [txt,tag] and stripping of trailing whitespaces at the of of a line [txt,tag,pre]. This level is the default because while providing good optimization the HTML markup is not destroyed and remains human readable. Level 3: Best stripping: Same as level 2 plus stripping of leading whitespaces on a line [txt]. This can also be recommended when you still want to make sure that the HTML markup is not destroyed in any case. But the resulting code is a little bit ugly because of the removed whitespaces. Level 4: Expert stripping: Same as level 3 plus stripping of HTML comment lines (``"<!-- ... -->"'') and crunching of HTML tag endsi [tag]. BE CAREFUL HERE: Comment lines are widely used for hiding some Java or JavaScript code for browsers which are not capable of ignoring those stuff. When using this optimization level make sure all your JavaScript code is hided correctly by adding HTMLstrip's "<nostrip>" tags around the comment delimiters. Level 5: Crazy stripping: Same as level 4 plus wrapping lines around to fit in an 80 column view window. This saves some newlines but both leads to really unreadable markup code and opens the window for a lot of problems when this code is used to layout the page in a browser. Use with care. This is only experimental! Additionally the following global strippings are done: "^ ": A leading newline is always stripped. "<suck>": The "<suck>" tag just absorbs itself and all whitespaces around it. This is like the backslash for line-continuation, but is done in Pass 8, i.e. really at the end. Use this inside HTML tag definitions to absorb whitespaces, for instance around %body when used inside "<table>" structures which at some point are newline-sensitive in Netscape Navigator. OPTIONS
-o outputfile This redirects the output to outputfile. Usually the output will be send to "stdout" if no such option is specified or outputfile is ""-"". -O level This sets the optimization/stripping level, i.e. how much HTMLstrip should compress the contents. -b blocksize For efficiency reasons, input is divided into blocks of 16384 chars. If you have some performance problems, you may try to change this value. Any value between 1024 and 32766 is allowed. With a value of 0, input is not divided into blocks. -v This sets verbose mode where some processing information will be given on the console. AUTHORS
Ralf S. Engelschall rse@engelschall.com www.engelschall.com Denis Barbier barbier@engelschall.com EN Tools 2014-04-16 htmlstrip(3)
All times are GMT -4. The time now is 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy