Sponsored Content
Top Forums Shell Programming and Scripting sed to delete character 0 only when it's on its own? Post 302448062 by Franklin52 on Wednesday 25th of August 2010 07:21:19 AM
Old 08-25-2010
Quote:
Originally Posted by Bashingaway
Sorry I should add I want to do this using just sed for reasons too boring to explain here.
But we are interested, it could be homework....Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use sed to delete a character

I built a 12 million record file and made a mistake, one field is 1 character too long. The record is 40 bytes and ends always in 999. I am trying to delete the 37 character in each record. Is this possible without doing a cut and paste. (1 Reply)
Discussion started by: bthomas
1 Replies

2. Shell Programming and Scripting

how to delete space character with sed

hi all, i want to delete a space character in word on unix script with command sed like : #dia n result: #dian is there anyone will help me ? regards, cahyo (1 Reply)
Discussion started by: cahyo3074
1 Replies

3. UNIX for Dummies Questions & Answers

Delete between 10th character and 20th character

Hi, I have a .txt and I need to delete the characters betwwen the 10th and 20th... How can I do that... I need to do somethink like these: %s/I don't know how to define a range between 10th and 20th character//g Can you help me... If I want the 10 first characters i do this:... (2 Replies)
Discussion started by: nuno_fbo
2 Replies

4. Shell Programming and Scripting

In Sed how can I replace starting from the 7th character to the 15th character.

Hi All, Was wondering how I can do the following.... I have a String as follows "ACCTRL000005022RRWDKKEEDKDD...." This string can be in a file called tail.out or in a Variable called $VAR2 Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Discussion started by: mohullah
5 Replies

5. Shell Programming and Scripting

Delete character in determinate position with sed/awk

Hello. I'm trying to delete one character in determinate position. Example: qwEtsdf123Ecv34 <delete character in positión 3> Result: qwtsdf123Ecv34 Plase, help me. Thanks (4 Replies)
Discussion started by: maria_florencia
4 Replies

6. Shell Programming and Scripting

sed or awk delete character in the lines before and after the matching line

Sample file: This is line one, this is another line, this is the PRIMARY INDEX line l ; This is another line The command should find the line with “PRIMARY INDEX” and remove the last character from the line preceding it (in this case , comma) and remove the first character from the line... (5 Replies)
Discussion started by: KC_Rules
5 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

How to delete a character using sed and or awk?

Hi, 1/ i have file test.txt 1 Jul 28 08:35:29 2014-07-28 Root::UserA 1 Jul 28 08:36:44 2014-07-28 Root::UserB i want to delete the seconds of the file, and the Root:: and the output will be: 1 Jul 28 08:35 2014-07-28 UserA 1 Jul 28 08:36 2014-07-28 UserB 2/i have another file test2.txt:... (8 Replies)
Discussion started by: fxsme
8 Replies

9. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
gd_delete(3)							      GETDATA							      gd_delete(3)

NAME
gd_delete -- remove a field from a dirfile SYNOPSIS
#include <getdata.h> int gd_delete(DIRFILE *dirfile, const char *field_code, int flags); DESCRIPTION
The gd_delete() function attempts to delete the field specified by field_code in the dirfile specified by dirfile. The field_code should not contain a representation suffix. The flags argument influences how the deletion attempt occurs. It may be zero, for the default behaviour, or else one or more of the fol- lowing flags, bitwise or'd together: GD_DEL_DATA If the field to be deleted is a RAW field, also delete the binary data file associated with it. If field_code specified a RAW field and this flag is not specified, the field will still be deleted but the binary file will be left untouched. GD_DEL_DEREF If the field to be deleted is a CONST or CARRAY field which is used as a parameter in the specification of other fields, resolve these other fields dependence on the deleted field by replacing instances of field_code in their field specifications with the val- ue of the scalar field. GD_DEL_FORCE Delete the indicated field, even if it is used in the specification of other fields, either as a input for a derived vector field or as a scalar parameter in a field specification. GD_DEL_META If the field to be deleted has metafields attached to it, attempt to delete those, too. If the field has metafields and this flag is not specified, the call will fail with the GD_E_DELETE error. RETURN VALUE
On successful deletion, zero is returned. On error, -1 is returned and the dirfile error is set to a non-zero error value. Possible error values are: GD_E_ACCMODE The specified dirfile was opened read-only. GD_E_ALLOC The library was unable to allocate memory. GD_E_BAD_CODE The field specified by field_code was not found in the database. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_DELETE The attempt to delete the field failed. Either the specified field is used in the specification of other fields and GD_DEL_FORCE or GD_DEL_DEREF was not specified, or it has metafields and GD_DEL_META was not specified. GD_E_INTERNAL_ERROR An internal error occurred in the library while trying to perform the task. This indicates a bug in the library. Please report the incident to the GetData developers. GD_E_PROTECTED The metadata of the fragment containing the field was protected from change. Or, the deletion of the binary data file associated with a RAW field was attempted and the data of the fragment was protected. GD_E_RAW_IO An error occurred while trying to close or delete the binary file associated with a RAW field. GD_E_UNKNOWN_ENCODING The GD_DEL_DATA flag was given but the encoding scheme of the indicated format specification fragment is not known to the library. As a result, the library was unable to delete the binary file associated with a RAW field. GD_E_UNSUPPORTED The GD_DEL_DATA flag was given but the encoding scheme of the indicated format specification fragment does not support deleting the binary file associated with a RAW field. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3). SEE ALSO
gd_open(3), gd_close(3), gd_error(3), gd_error_string(3), gd_metaflush(3) Version 0.7.0 3 November 2010 gd_delete(3)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy