Hi
I have an XML file with strings XABCD, XEFGHX and XIJKLX. I would like to replace XABCDX with "This is the first string", XEFGHX with "This is the second string" and XIJKLX with "This is the third string".
What is the best way to implement this? Should I have a file with the data that is... (4 Replies)
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Hi all
I have the problem to substitute a string with newline in Perl. Can anybody help me?
And also how to replace a string with opening bracket (e.g. (START ) with a whitespace/null character?
Thanks in advance. (1 Reply)
I want to replace a text string with a newline. I have a long text file of random characters. I want to replace all the occurences of "pe" with a newline. How can I do that in Unix? There's a thread from 2004 saying that you can do something like this with sed by actually pressing the return... (1 Reply)
Input:
--------------------------
123asd 456sdasda 789a
-------------------------
output wanted:
---------------------
123asd
456sdasda
789a
----------------------
I want this by sed in simple way
please help (I know by: tr ' ' '\n' < inputfile )I want it by sed only (5 Replies)
Hi
I have written a shell script which used sed code below
sed -i 's/'"$Pattern"'/ /g' $FileName
I want to count the length of Pattern and replace it with equal number of spaces in the FileName.
I have used $(#pattern) to get the length but could not understand how to replace... (8 Replies)
Hi,
I'm struggling with a string replacement.
I have an XML file which is in the following layout
<FUNCTION>
<PRODUCTS>
<PRODUCT CODE="PRODUCE" ACTION="amend" VALIDATE="no">
<SUPPLIER PRODUCT="PRODUCT" ACTION="amend" CODE="SUPPLIER">
<STOCK_QUANTITY DATA="21"/>
... (15 Replies)
Hi ,
I have a huge file with following records and I want to replace the last comma with ',NULL'. I try using SED but could not create a correct script .
In my opinion I need a script which can convert ,/n with ,NULL/n
1,CHANGE_MEMBER,2010-12-28 00:05:00,
2,CHANGE_MEMBER,2012-09-02... (8 Replies)
I have a string like below:
{\rtf1\fbidis\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil MS Sans Serif;}}
\viewkind4\uc1\pard\ltrpar\lang2057\f0\fs16 19/11/2010 SOME DESCRIPTION. \par
\lang1033\f1\par
}
I have to replace the newline character with null in the... (8 Replies)
Hi,
I am trying to do some transformation on a large file and I am getting some troubles trying remove newlines only when the last character of a line is a symbol (in this case is a pipe "|").
I have tried with sed like this:
sed -i 's/|\n/|/g' my_file
or
sed -i 's/|$/|/gg' my_file... (5 Replies)
Discussion started by: ngb
5 Replies
LEARN ABOUT CENTOS
binsrch
BINSRCH(3) WordNettm Library Functions BINSRCH(3)NAME
bin_search, copyfile, replace_line, insert_line - general purpose functions for performing a binary search
SYNOPSIS
char *bin_search(char *key, FILE *fp);
void copyfile(FILE *fromfp, FILE *tofp);
char *replace_line(char *new_line, char *key, FILE *fp);
char *insert_line(char *new_line, char *key, FILE *fp);
DESCRIPTION
The WordNet library contains several general purpose functions for performing a binary search and modifying sorted files.
bin_search() is the primary binary search algorithm to search for key as the first item on a line in the file pointed to by fp. The delim-
iter between the key and the rest of the fields on the line, if any, must be a space. A pointer to a static variable containing the entire
line is returned. NULL is returned if a match is not found.
The remaining functions are not used by WordNet, and are only briefly described.
copyfile() copies the contents of one file to another.
replace_line() replaces a line in a file having searchkey key with the contents of new_line. It returns the original line or NULL in case
of error.
insert_line() finds the proper place to insert the contents of new_line, having searchkey key in the sorted file pointed to by fp. It
returns NULL if a line with this searchkey is already in the file.
NOTES
The maximum length of key is 1024.
The maximum line length in a file is 25K.
If there are no additional fields after the search key, the key must be followed by at least one space before the newline character.
SEE ALSO wnintro(3), morph(3), wnsearch(3), wnutil(3), wnintro(5).
WARNINGS
binsearch() returns a pointer to a static character buffer. The returned string should be copied by the caller if the results need to be
saved, as a subsequent call will replace the contents of the static buffer.
WordNet 3.0 Dec 2006 BINSRCH(3)