sed command to delete points in a certain colum


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed command to delete points in a certain colum
Prev   Next
# 1  
Old 04-27-2009
sed command to delete points in a certain colum

Dear Unix users,

I have a (I think simple) question;

I have a file (out.dat) like below,
the file contains some line which include 'LOS' string.
.
LOS 46.5360 91.0220 200708.2515.4900. 5400 64 1100010
.
.
I would like to delete the points in 4th column.

When I used the below sed command:
Code:
sed -e '/LOS/s/\.//g' out.dat

it gives
.
LOS 465360 910220 20070825154900 5400 64 1100010
.

it deletes all the points in the line.

How can I specify that I only want to delete the points at 4th column (i.e 200708.2515.4900.)

Thank you very much,
Murat

Last edited by Yogesh Sawant; 04-27-2009 at 03:04 PM.. Reason: added code tags
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to delete line from file using sed command?

hello Team, I want to delete below linux using sed command but I am getting error.sed -i '/url=/status.cgi?hostgroup=/d' 3 error:sed: -e expression #1, char 32: unknown option to `s' Could you please help me with correct syntax. My line contain / character because of that I am getting... (4 Replies)
Discussion started by: ghpradeep
4 Replies

2. Shell Programming and Scripting

sed command to delete a pattern in a file

Hi Everyone, I have an unusual requirement. Here is where i am stuck for sometime now... I have this text file.. lets say .. output.sql... it has lot of entries... here below is part of the entry... .. . . . . . . . . . . . . . . . .... (3 Replies)
Discussion started by: vivek d r
3 Replies

3. Shell Programming and Scripting

sed command to delete everything after > on line

I have a large data file that I need to edit. There are lines like, > <IDNUMBER> (ST000002) > <SUPPLIER> (ST000002) > <IDNUMBER> (ST000004) > <SUPPLIER> (ST000004) and I need to delete everything after the >, excepting the end of line. > <IDNUMBER> > <SUPPLIER> > <IDNUMBER> > ... (4 Replies)
Discussion started by: LMHmedchem
4 Replies

4. Shell Programming and Scripting

delete the line with a particular string in a file using sed command.

Hello, I want to delete all lines with given string in file1 and the string val is dynamic. Can this be done using sed command. Sample: vars="test twinning yellow" for i in $vars do grep $i file1 if then echo "Do Nothing" else sed `/$i/d` file1 fi done Using the above... (5 Replies)
Discussion started by: PrasadAruna
5 Replies

5. Shell Programming and Scripting

sed command to delete line

HI, Im using the below commmand to delete lines having "(" at the start of a line. sed -e '/^(/d' But i need a command to delete lines that has only "(" in it and no other strings. infile - asdf asdf ( asdf ( asd outfile (1 Reply)
Discussion started by: dvah
1 Replies

6. Shell Programming and Scripting

Delete a line between selected lines using sed or any other command

I want to delete a line between selected lines using sed: e.g. : Between "bus" to "pins", delete lines conaining "signal" word. Input : bus direction signal new signal old pins signal ok end Desired Output: bus direction pins signal end (4 Replies)
Discussion started by: nehashine
4 Replies

7. Shell Programming and Scripting

SED delete only first line command - Help need

Can any one help me how the sed delete only first line command (D) works. sed -f sedcmds File.txt In this how the sed delete only first line command (D) works to delete the blank lines appearing more than ones leaving only one blank and deleting others blanks. While doing step by step when... (2 Replies)
Discussion started by: gwgreen1
2 Replies

8. Shell Programming and Scripting

sed command to delete row

I want to use sed command to delete a matched row with a pattern. And I also want to delete previous and next row of that row. Which option can I use with sed ? (9 Replies)
Discussion started by: anhtt
9 Replies

9. Shell Programming and Scripting

sed or awk to convert text files with recurring headings to rows and colum

I have many text file reports generated by a Information Assurance tool that I need to get into a .CSV format or Excel tab delimited format. I want to use sed or awk to grab all the information in the sample text file below and create column headings:Risk ID, Risk Level, Category, Description, How... (5 Replies)
Discussion started by: Bjoeboo
5 Replies

10. Shell Programming and Scripting

What's wrong with this sed command? delete & append

I want to write a sed command that does the following work: file: <a>asdfasdf<\s> <line>hello</line> <b>adf<\c> <b>tttttttt<\c> output: name=hello sed -e 's/^*//' -n -e '/<line>/s/<*>//gp;' -e 's/^/name="/g' file but I can not append "=" after getting the line with... (5 Replies)
Discussion started by: minifish
5 Replies
Login or Register to Ask a Question
DBMMANAGE(1)							     dbmmanage							      DBMMANAGE(1)

NAME
dbmmanage - Manage user authentication files in DBM format SYNOPSIS
dbmmanage [ encoding ] filename add|adduser|check|delete|update username [ encpasswd [ group[,group...] [ comment ] ] ] dbmmanage filename view [ username ] dbmmanage filename import SUMMARY
dbmmanage is used to create and update the DBM format files used to store usernames and password for basic authentication of HTTP users via mod_authn_dbm. Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by dbmman- age. This program can only be used when the usernames are stored in a DBM file. To use a flat-file database see htpasswd. This manual page only lists the command line arguments. For details of the directives necessary to configure user authentication in httpd see the httpd manual, which is part of the Apache distribution or can be found at http://httpd.apache.org/. OPTIONS
filename The filename of the DBM format file. Usually without the extension .db, .pag, or .dir. username The user for which the operations are performed. The username may not contain a colon (:). encpasswd This is the already encrypted password to use for the update and add commands. You may use a hyphen (-) if you want to get prompted for the password, but fill in the fields afterwards. Additionally when using the update command, a period (.) keeps the original password untouched. group A group, which the user is member of. A groupname may not contain a colon (:). You may use a hyphen (-) if you don't want to assign the user to a group, but fill in the comment field. Additionally when using the update command, a period (.) keeps the original groups untouched. comment This is the place for your opaque comments about the user, like realname, mailaddress or such things. The server will ignore this field. Encodings -d crypt encryption (default, except on Win32, Netware) -m MD5 encryption (default on Win32, Netware) -s SHA1 encryption -p plaintext (not recommended) Commands add Adds an entry for username to filename using the encrypted password encpasswd. dbmmanage passwords.dat add rbowen foKntnEF3KSXA adduser Asks for a password and then adds an entry for username to filename. dbmmanage passwords.dat adduser krietz check Asks for a password and then checks if username is in filename and if it's password matches the specified one. dbmmanage pass- words.dat check rbowen delete Deletes the username entry from filename. dbmmanage passwords.dat delete rbowen import Reads username:password entries (one per line) from STDIN and adds them to filename. The passwords already have to be crypted. update Same as the adduser command, except that it makes sure username already exists in filename. dbmmanage passwords.dat update rbowen view Just displays the contents of the DBM file. If you specify a username, it displays the particular record only. dbmmanage pass- words.dat view BUGS
One should be aware that there are a number of different DBM file formats in existence, and with all likelihood, libraries for more than one format may exist on your system. The three primary examples are SDBM, NDBM, the GNU project's GDBM, and Berkeley DB 2. Unfortunately, all these libraries use different file formats, and you must make sure that the file format used by filename is the same format that dbm- manage expects to see. dbmmanage currently has no way of determining what type of DBM file it is looking at. If used against the wrong for- mat, will simply return nothing, or may create a different DBM file with a different name, or at worst, it may corrupt the DBM file if you were attempting to write to it. dbmmanage has a list of DBM format preferences, defined by the @AnyDBM::ISA array near the beginning of the program. Since we prefer the Berkeley DB 2 file format, the order in which dbmmanage will look for system libraries is Berkeley DB 2, then NDBM, then GDBM and then SDBM. The first library found will be the library dbmmanage will attempt to use for all DBM file transactions. This ordering is slightly different than the standard @AnyDBM::ISA ordering in Perl, as well as the ordering used by the simple dbmopen() call in Perl, so if you use any other utilities to manage your DBM files, they must also follow this preference ordering. Similar care must be taken if using programs in other languages, like C, to access these files. One can usually use the file program supplied with most Unix systems to see what format a DBM file is in. Apache HTTP Server 2004-12-10 DBMMANAGE(1)