09-16-2004
Replacing string1 with string2 in many files
I have 70 files and want to replace string1 with string2. How can i do that?.
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
can any one suggest me the script to grep multiple strings from ps -ef
pls correct the below script . its not working/
i want to print OK if all the below process are running in my solaris system. else i want to print NOT OK.
bash-3.00$ ps -ef | grep blu
lscpusr 48 42 ... (11 Replies)
Discussion started by: steve2216
11 Replies
2. Shell Programming and Scripting
Hello All...
I have a text file (.ics) which I need to read into a variable but ONLY the part including and after 'BEGIN:VEVENT' and ending with END:VEVENT
Anything before BEGIN:VEVENT or after END:VEVENT should be ignored.
Thanks for input
Jeff
BEGIN:VCALENDAR
VERSION:2.0... (3 Replies)
Discussion started by: uptimejeff
3 Replies
3. Shell Programming and Scripting
How do I use awk to find the records in a file that contains two specific strings?
I have tried piping and using awk two times, but I don't know how to do it in one action. (2 Replies)
Discussion started by: locoroco
2 Replies
4. UNIX for Dummies Questions & Answers
i have 12 files.in all the files the first line will be like:
H|20111213 09:23:00|267628|617
I need to replace that with current date:
H|20111217 09:23:00|267628|617
Like this i need to do it for all the files.
One way i can think is inside a loop, use the below code
a=`sed... (1 Reply)
Discussion started by: pandeesh
1 Replies
5. Shell Programming and Scripting
i'm trying to figure out the easiest way to replace a string:
pineapple pineapple-reg
basketball basketball-reg
football foot-reg-ball
i'm storing the above in a file called wordstoreplace.txt
for each line above, the word in the first column is to be replaced by the word in the second... (4 Replies)
Discussion started by: SkySmart
4 Replies
6. Shell Programming and Scripting
hi,
i am having a certain files in a folder where i need to replace the extension with similar file name
for eg
1.csv
2.csv
3.csv
4.csv
i need to replace the extension
1.csv
1.txt
2.csv
2.txt
3.csv
3.txt (3 Replies)
Discussion started by: rohit_shinez
3 Replies
7. UNIX for Beginners Questions & Answers
My OS is Windows 10 and I am using Cygwin.
The file 1 content is:
USE solution 2; -4.000
USE solution 3; -4.000
…
USE solution 29; -4.000
USE solution 30; -4.000
USE solution 31; -4.000
….
USE solution 89; -4.000
...
USE solution 202; -4.000
etc...
I need to replace... (8 Replies)
Discussion started by: supernono06
8 Replies
8. Shell Programming and Scripting
Hello,
My aim is to search string1 in all lines. When found, find and replace string2 by string3 if possible.
TextFile:
Here is my first line
Second line with string1 & string2
Not last line but it contains string1
Expected output:
Here is my first line
The second line with string1 &... (6 Replies)
Discussion started by: baris35
6 Replies
9. Shell Programming and Scripting
Hello,
This is a bit complicated for me.
My scenario in MyFile:
Search string1,
When string1 is found, grep the line containing string1, go back over that line in upward direction and grep the first line containing string2.
Here is an example:
MyFile
His email address... (17 Replies)
Discussion started by: baris35
17 Replies
10. UNIX for Beginners Questions & Answers
I found this in the forum that searches a file for string1, substitute all occurrences of string2 with string3.
(Title: Replace string2 by string3 where string1 is found in line)
>> sed -i '/string1/s/string2/string3/g' TextFile
How will I perform the same sed command and only substitute... (3 Replies)
Discussion started by: apalex
3 Replies
LEARN ABOUT OPENSOLARIS
ssastringcpy
SSAStringCpy(3SNMP) SNMP Library Functions SSAStringCpy(3SNMP)
NAME
SSAStringCpy, SSAStringInit, SSAStringToChar, SSAStringZero - Sun Solstice Enterprise Agent string helper functions
SYNOPSIS
cc [ flag ... ] file ... -lssasnmp [ library .. ]
#include <impl.h>
void *SSAStringZero(String *string);
int SSAStringInit(String *string, uchar_t *chars, int len,
char *error_label);
int SSAStringCpy(String *string1, String *string2, char *error_label);
char *SSAStringToChar(String string);
DESCRIPTION
The SSAStringCpy() function makes a deep copy of string2 to string1. This function assumes that string1 has been processed by the SSAS-
tringZero() function. Memory is allocated inside the string1 and the contents of string2, not just the pointer, is copied to the string1.
If an error is encountered, an error message is stored in the error_label buffer.
The SSAStringInit() function copies the char array from chars to the string instance with the specified length len. This function assumes
that the string instance has been processed by the SSAStringZero() function or no memory is allocated inside the string instance. If an
error is encountered, an error message is stored in the error_label buffer.
The SSAStringToChar() function returns a temporary char array buffer for printing purposes.
The SSAStringZero() function frees the memory inside of the String instance, but not the string object itself.
RETURN VALUES
The SSAStringInit() and SSAStringCpy() functions return 0 if successful and -1 if error.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Obsolete |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO
attributes(5)
SunOS 5.11 30 Apr 2006 SSAStringCpy(3SNMP)