06-07-2005
SED: Matching a string with whitespace?
I am trying to search through a text file and replace the number 1 at the beginning of the string in the second field with the number 9. There maybe one or more occurrences of whitespace between the string GPA131 and 17049333610. Does anyone know how to do this with sed?
GPA131 17049333610
After the search and replace the output file should read as follows:
GPA131 97049333610
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys, I hope you can help me with my problem.
I have a text file that contains lines like this:
78 ANGELO -809.05
79 ANGELO2 -5,000.06
I need to find all occurences of amounts that are negative and replace them with x's
78 ANGELO xxxxxxx
79... (4 Replies)
Discussion started by: amangeles
4 Replies
2. Shell Programming and Scripting
I'm trying to remove the whitespace at the end of each line of a text file in ksh.
Im using
sed s/ $//g' file1.txt > file2.txt
It's not working. Any clues? (3 Replies)
Discussion started by: b.hamilton
3 Replies
3. Shell Programming and Scripting
Hello,
I would assume the expression ^$ should match a null string. Yet when I run:
echo -n | sed 's/^$/nullstring/'
I get no output.
Can anyone tell me why? (6 Replies)
Discussion started by: Allasso
6 Replies
4. UNIX for Advanced & Expert Users
I have teh follwing details in a file:
SmithA..... ,,400
JonesA..... ,,300
JamesA..... ,,600
BakerA ,,800
ChrisA ,,1200
the first field name is 6 characters in length always and alays ends with an 'A'.
The periods denote white space (space caharacters), as you can see on certain... (1 Reply)
Discussion started by: SAMZ
1 Replies
5. UNIX for Dummies Questions & Answers
Greetings
I need to replace "whitespace" in a file with the newline character aka carriage return
My command is either wrong or not interpreted properly by me shell
sed s/" "/\\n" "/g nets > nets1
or
sed s/" "/\n" "/g nets > nets1
nets (input file)
13MHZ_IN... (4 Replies)
Discussion started by: awk_sed_hello
4 Replies
6. Shell Programming and Scripting
Hi, I'm very new to shell scripting and have searched google and this forum for quite some time now.
I have the following in my xml file:
<recipients>
<member>value1</member>
</recipients>
I need to find a string <recipients> that follows with a new-line and bunch of spaces and... (5 Replies)
Discussion started by: mgharios
5 Replies
7. Shell Programming and Scripting
Hi
Following is an example line.
echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:"
I want it's output to be
200
However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Discussion started by: shahanali
3 Replies
8. Shell Programming and Scripting
I have a 13 number string, some whitespace, and then /mp3.
I need to join them. Everyline that I need this for begins with "cd" (without the quotes).
What it looks like now:
cd media/Audio/WAVE/9781933976334 /mp3 What I want my output to be:
cd media/Audio/WAVE/9781933976334/mp3 The 13... (7 Replies)
Discussion started by: glev2005
7 Replies
9. Programming
Greetings everyone!
I keep getting a very long whitespace after some char strings I'm outputting.
This is the function where I input the names, last names...:
void add_to_list (void)
/* Add a new name to our address book */
{
ADDRESS *new_name;
FILE *outfile;
new_name=... (4 Replies)
Discussion started by: Nephilim.F
4 Replies
10. UNIX for Dummies Questions & Answers
Hi again
I have an xml file and want to remove the leading white space as it causes me issues later in my script
I see sed is possible but cant seem to get it to work
I tried
sed 's/^ *//' file.xml
output
<xn:VsDataContainer id="1U104799" modifier="update">
... (10 Replies)
Discussion started by: aniquebmx
10 Replies
LEARN ABOUT HPUX
dteditorinvokefindchangedialog
DtEditorInvokeFindChangeDialog(library call) DtEditorInvokeFindChangeDialog(library call)
NAME
DtEditorInvokeFindChangeDialog -- display the DtEditor widget dialog for searching and replacing text
SYNOPSIS
#include <Dt/Editor.h>
void DtEditorInvokeFindChangeDialog(
Widget widget);
DESCRIPTION
The DtEditorInvokeFindChangeDialog function displays the Find/Change dialog for the DtEditor widget. This dialog enables a user to search
for, and optionally replace, a string in the text for the DtEditor widget. It also allows the user to specify a replacement string, which
can be substituted for either the next occurrence of the search string or all occurrences. The Find/Change dialog remains displayed until
the user closes it. For a complete description of the Find/Change dialog see DtEditor.
Subsequent searches for the last search string entered can be made by calling DtEditorFind(3). Subsequent substitutions can be made with
DtEditorChange(3).
The widget argument specifies the DtEditor widget ID.
For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3).
RETURN VALUE
The DtEditorInvokeFindChangeDialog function returns no value.
SEE ALSO
Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorChange(3), DtEditorFind(3).
DtEditorInvokeFindChangeDialog(library call)