Thank you RudiC.
The ABC pattern can be any where in the file. Please find he corrected data:
I have tried using the awk, it replaces the pattern, but also i need other lines from the file which is not getting displayed.
I have tried using below. Could you please let me know what is next and 1 in the command are. I have also tried using sed which is not working due to syntax error. i have tried correcting it but having the same issue.
awk '/ABC/ {print substr ($0, 1, 119);}' file
I build several files by using the cut command to grab select fields(columns) from a really bid csv file. Each file is one column of data. I then put them together using paste command. Here is the code built in tcsh:
cut -d , -f 1 some.csv > 1.csv
cut -d , -f 10 some.csv > 10.csv
paste 1.csv... (2 Replies)
Hi everyone,
I am new to the world of shell script programming.
I have a file named Fnd1.txt which has the contents as below.
I need to replace the \t with the tab space. Can any one help me
to write a perl scipt for this.
USA45V1\tG\t341029
USAV1T1\tG\t450545
USAREJ1\tG\t572645... (5 Replies)
Is there a way to do a find and replace in a .gz file in a single script ?
I can always unzip, find and replace and then zip it again but would hate to do this everytime.
Thanks !
Vivek (1 Reply)
I have a file that is HTML encoded. Each line has something like this on each line..
<href=http://link.com/username.aspx>username </a> more info.. <a href=http://link.com/info1.aspx>info1</a> more code... <a href=http://link.com/info2.aspx>info2</a>
I have one goal really.. to clean up the... (2 Replies)
Hi Everyone,
I am new to this forum and new to sed/awk programming too !!
I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column.
file 1:
(assert (=... (21 Replies)
Hi,
This is probably quite simple for an expert, but I keep getting confused about the best approach, grep, awk, sed.
What I have is a range of files numbered 1 to 100. They go
file1.txt
file2.txt
and so on
In each file I need to find and replace a couple of items and rename add a... (5 Replies)
Legends,
I have a file /tmp/list.txt
I want to find "/bin/" and replace it with "/log/"
I tried the follwoing but no luck
Sandy: /tmp> perl -pi -e 's/\/bin\/\/log\/' /tmp/list.txt >> /tmp/try
Substitution pattern not terminated at -e line 1.
AND,
Sandy: /tmp> perl -pi -e... (2 Replies)
Hi,
I am want find and replace in following content in the file.
i want to repalce a word
TABLESPACE XCRM_<ANY_CHAR>
to TABLESPACE XCRM
Sample File to Replace :
LOB(COMPLEX_VALUE) STORE AS
(
TABLESPACE XCRM_MED_D_NEW
STORAGE(INITIAL 64K BUFFER_POOL DEFAULT)
ENABLE... (3 Replies)
Hi I am having a file which has like this content shown below
Aaa,bb,cc,dd
Xxx,yy,d,12
Dodd,12-Jun,t
I need to replace last line like this
Aaa,bb,cc,dd
Xxx,yy,d,12
Dodd,10-August,t (13 Replies)
Hello Forum.
I have a file called abc.sed with the following commands;
s/1/one/g
s/2/two/g
...
I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat
sed -f abc.sed abc.dat >... (10 Replies)
Discussion started by: pchang
10 Replies
LEARN ABOUT HPUX
dteditorreplace
DtEditorReplace(library call) DtEditorReplace(library call)
NAME
DtEditorReplace -- replace a portion of the contents of a DtEditor widget
SYNOPSIS
#include <Dt/Editor.h>
DtEditorErrorCode DtEditorReplace(
Widget widget,
XmTextPosition startPos,
XmTextPosition endPos,
DtEditorContentRec *data);
DESCRIPTION
The DtEditorReplace function replaces part of the contents of a DtEditor widget with a string, a wide character string or sized buffer.
The data is transferred to the DtEditor widget using a DtEditorContentRec, which indicates the type of data being transferred along with
the actual data. All data following the start position and up to, but not including, the end position is replaced. If the start position
and the end position are equal, the data is inserted after the end position. The character positions begin at zero and are numbered
sequentially from the beginning of the text. After the replacement, the insertion cursor is positioned after the last character inserted.
The widget argument specifies the DtEditor widget ID.
The startPos argument specifies the starting character position of the portion to replace. The replacement begins at this character.
The endPos argument specifies the ending character position of the portion to replace. The replacement ends before this character.
The data argument is a pointer to the data structure containing the data to insert.
For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3).
For a complete definition of DtEditorContentRec, see Dt/Editor.h - DtEditor(5).
RETURN VALUE
Upon successful completion, the DtEditorReplace function returns one of the following values:
DtEDITOR_NO_ERRORS
The data was replaced sucessfully.
DtEDITOR_NULLS_REMOVED
NULL characters were found and removed from the data.
Otherwise, if the DtEditorReplace function cannot replace the data in the DtEditor widget, it returns one of the following values:
DtEDITOR_INVALID_TYPE
The Type field is not recognized.
DtEDITOR_INVALID_RANGE
The startPos argument is greater than the endPos argument.
DtEDITOR_ILLEGAL_SIZE
The size of the buffer passed in is negative.
DtEDITOR_NULL_ITEM
The data buffer is NULL.
DtEDITOR_INSUFFICIENT_MEMORY
Not enough system memory is available to replace the data.
EXAMPLES
The following code segment modifies the contents of a DtEditor widget to ``The quick fox.''
Widget editor;
DtEditorContentRec cr;
DtEditorErrorCode status;
XmTextPosition start = (XmTextPosition) 4,
end = (XmTextPosition) 9;
char *sampleString1="The brown fox",
*sampleString2="quick";
cr.type = DtEDITOR_TEXT;
cr.value.string = sampleString1;
status = DtEditorSetContents(editor, &cr);
if (status != DtEDITOR_NO_ERRORS && status != DtEDITOR_NULLS_REMOVED) {
printf("Unable to set contents of the widget
");
} else {
cr.type = DtEDITOR_TEXT;
cr.data.string = sampleString2;
status = DtEditorReplace(editor, start, end, &cr);
if (status != DtEDITOR_NO_ERRORS)
printf("Unable to replace part of the widget contents
");
}
APPLICATION USAGE
If the data is in a disk file, rather than in memory, the application should use DtEditorReplaceFromFile(3).
SEE ALSO
Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorAppend(3), DtEditorAppendFromFile(3), DtEditorGetContents(3), DtEditorInsert(3), DtEdi-
torInsertFromFile(3), DtEditorReplaceFromFile(3), DtEditorSaveContentsToFile(3), DtEditorSetContents(3), DtEditorSetContentsFromFile(3).
DtEditorReplace(library call)