Sponsored Content
Top Forums Shell Programming and Scripting Removing trailing zeros using sed Post 302406775 by daptal on Tuesday 23rd of March 2010 10:48:11 PM
Old 03-23-2010
Quote:
Originally Posted by alister
Code:
sed 's/0000,/,/' file


i think it would remove 0's from each field

it shd be
Code:
sed 's/0000,/,/1' file

and that would still be wrong if the first field doesnot have any zero then it would remove from the subsequent fields

Last edited by daptal; 03-23-2010 at 11:50 PM.. Reason: tags added
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing leading zeros from a variable

How do I remove or add leading zeroa from a variable. To make variable 10 characters long when adding zeros. (6 Replies)
Discussion started by: toshidas2000
6 Replies

2. Shell Programming and Scripting

How to delete trailing zeros from a variable

Hi All I want to delete trailing zeros from varible. ex: if variable value is 1234.567000 result as 1234.567 if variable has 1234.0000 result as 1234 if variable as abcd.fgh result as abcd.fgh Can somone give me a solution using awk? (16 Replies)
Discussion started by: Chandu2u
16 Replies

3. Shell Programming and Scripting

Removing Zeros in front of a number

Hi All, I would like to trim the following input. My condition is as long as there's a zero on the left of the number, remove the zeros. Can anybody help me by using sed or awk ? Eg: 0011 => change to => 11 0333 => change to => 333 4444 => No change => 4444 (13 Replies)
Discussion started by: Raynon
13 Replies

4. Shell Programming and Scripting

sed: removing any and all trailing digits?

We have a large number of oracle database related scripts that utilize the environment variables $ORACLE_SID and $DBNAME. In a single instance database the $ORACLE_SID is the same as the database name $DBNAME. So we have simply set DBNAME = $ORACLE_SID. However, now that we are clustering with RAC,... (5 Replies)
Discussion started by: Squeakygoose
5 Replies

5. Shell Programming and Scripting

Removing trailing zeroes

So, I can't figure out how to do a previous question with printf, so I'm taking a different approach. Suppose I have a set of numbers: 1200,135.000000,12.30100,3212.3200,1.759403,,1230,101.101010,100.000000 I want to remove all trailing zeroes after the decimal, and, if it ends up orphaned,... (8 Replies)
Discussion started by: treesloth
8 Replies

6. Shell Programming and Scripting

Remove trailing zeros

Hi I have a simple request but can't find the answer. I want to remove trailing zeros, and in some cases the fullstops, from the input data. Example of input file: FR002_15.000_20.000 SD475_5.000_10.500 FG5647_12.250_15.500 BH2463_30.555_32.000 Desired output file would be: ... (10 Replies)
Discussion started by: theflamingmoe
10 Replies

7. Shell Programming and Scripting

Removing just the trailing commas :-(

Hi all, I haven't needed to do any shell based editing for nearly 20 years, and no amount of searching around has found me a solution to this very simple problem :-( I have a csv file. Some lines have three commas at the end. This means the invoice hasn't been paid. I'd like to use sed / grep... (4 Replies)
Discussion started by: chardyzulu
4 Replies

8. UNIX for Dummies Questions & Answers

Removing trailing characters

I have been given a shell script that I need to amend. To do the following extract the filename from the flag file by removing the .flag extension. # Local variables # Find if the flag files exists MASK=coda_mil2*.flag # Are there any files? bookmark="40" fileFound=0 ls -1... (3 Replies)
Discussion started by: andymay
3 Replies

9. Shell Programming and Scripting

Removing Trailing Line

I have been trying to remove empty lines and lines just filled with spaces. I have used the following command which does work. sed -i "/^\s*$/d" Except it leaves one single trailing line at the very end of the file. For the life of me I cant figure out why I cant remove that last trailing... (2 Replies)
Discussion started by: user8282892
2 Replies

10. UNIX for Beginners Questions & Answers

Remove trailing zeros from numbers

Hi, I am trying to remove trailing zeros from numbers in a csv file. CSV Input : 0.5000,abc,2.00,2.400,285.850,285a.850,205.180800,mno000,a0b0,2.860 Expected Output : .5,abc,2,2.4,285.85,285a.850,205.1808,mno000,a0b0,2.86 Can you please help. Thanks. (11 Replies)
Discussion started by: manubatham20
11 Replies
anno(1mh)																 anno(1mh)

Name
       anno - annotate messages

Syntax
       anno [ +folder ] [ msgs ] [ -component field ] [ -help ] [ -[no]inplace ] [ -text body ]

Description
       The command annotates a message by adding one or more header fields to the message.

       The  command  allows  you to choose the name of the header field which you add.	It records the date at which the message is annotated, and
       allows you to add an additional field containing text, if you wish.

       You can use with and to keep track of how you have distributed, forwarded, or replied to messages.

       By default, annotates the current message in the current folder.  You can select another message by using the msg  and  +folder	arguments.
       You can also annotate more than one message, or a range of messages.

Options
       -component field
		 Specifies  the  name  of the header field which adds.	It should be a valid RFC 822-style message field name, which means that it
		 should consist of alphanumeric characters or dashes only.  If you do not supply this option, will prompt you for the field name.

       -help	 Prints a list of the valid options to this command.

       -inplace
       -noinplace
		 The -inplace switch causes annotation to be done in place in order to preserve links to the annotated message.

       -text body
		 Allows you to add a header field containing text to the message.  The command will create a second header field on  the  message,
		 containing  the  text that you specify.  If the text contains a space, you must enclose the text in double quotes (").  If you do
		 not supply this option, adds only one field, which contains the date of the annotation.

       The default settings for this command are:

	      +folder defaults to the current folder
	      msgs defaults to the current message
	      -noinplace

Examples
       This example annotates message number 1 in the folder The -component option specifies the name of the header field:
       % anno 1 +test -component Forwarded
       The following field is added to the message header:
       Forwarded: Tue, 08 Jan 91 16:10:06 +0000

       The next example shows how to use the -text option to add an additional field:
       % anno -component Forwarded -text "to David - as requested"
       The following lines are added to the message header:
       Forwarded: Tue, 08 Jan 91 16:13:27 +0000
       Forwarded: to David - as requested

       The final example shows how prompts for the name of the header field, if the -component option is not supplied:
       % anno
       Enter component name: forwarded
       The following line is added to the message:
       forwarded: Tue, 08 Jan 91 16:21:58 +0000

Profile Components
       Path:   To determine your Mail directory

Files
       The user profile.

See Also
       dist(1mh), forw(1mh), repl(1mh)

																	 anno(1mh)
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy