10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This seems like it should be an easy problem, but for some reason I am struggling with the solution.
I simply want to replace all characters after the first 3 characters with another character, preferably with sed.
Thanks in advance.
Like this, but producing the proper number of *'s:
sed... (30 Replies)
Discussion started by: leolson
30 Replies
2. UNIX for Dummies Questions & Answers
Trying to use SED to replace numbers that fall into a range but can't seem to get the logic to work and am wondering if SED will do this. I have a file with the following numbers
3
26
20
5. For the numbers that are greater than zero and less than 25, SED would add the word range after the... (7 Replies)
Discussion started by: jimmyf
7 Replies
3. Shell Programming and Scripting
I have several files in a directory that look like this:
jacket-n r
potential-n -
outcome-n f
reputation-n b
I want to replace the characters in the second column with certain numbers. For instance, I want the letters 'f', 'r' and 'b' in the second column to replaced with 0 and I want the... (1 Reply)
Discussion started by: owwow14
1 Replies
4. UNIX for Dummies Questions & Answers
How can I specify special meaning characters like ^ or $ inside a regex range. e.g
Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character.
I tried the following but it does not work:
sed 's/\(\)/<do something here>/g' file1
... (3 Replies)
Discussion started by: jawsnnn
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I require to replace 2 items:
1. replace start of all lines in a file with ' except the first line
2. replace end of all lines in a file with '||chr( except last line
I am able to do the entire file using
sed -e s/^/\'/g -e s/$/\'\|\|chr\(/g "$file" > newfile.txt
but am not yet... (3 Replies)
Discussion started by: Chella15
3 Replies
6. Shell Programming and Scripting
Hi,
I require to replace 2 items:
1. replace start of all lines in a file with ' except the first line
2. replace end of all lines in a file with '||chr( except last line
I am able to do the entire file using
sed -e s/^/\'/g -e s/$/\'\|\|chr\(/g "$file" > newfile.txt
but am not yet able... (0 Replies)
Discussion started by: Chella15
0 Replies
7. Shell Programming and Scripting
Hi,
I have a set of strings in filea.
I want to search string xyz in fileb and replace next line in file b with the content from filea.
#cat filea
abc
def
ghi
#cat fileb
asdkjdslka
sajljskdjoi
xyzjjjjkko
aaaaaaaa
bbbbbbbb
cccccccc
xyzsdsajd
dddddddd
eeeeeeee (2 Replies)
Discussion started by: anilvk
2 Replies
8. Shell Programming and Scripting
Howdy!
I'm trying to automate editing of a configuration file (custom.conf for GDM). I need to find every line between a line that starts with "" and the next line that starts with "", I want to preserve that line, but then delete all the lines in that configuration section and then insert... (3 Replies)
Discussion started by: TXTad
3 Replies
9. Shell Programming and Scripting
Hi,
I want to replace the srting '; with ABCD'; in a file from line 1 to line 65. Is there any single command to do it without using awk
Thanks for quick reply
https://www.unix.com/images/misc/progress.gif (3 Replies)
Discussion started by: tosattam
3 Replies
10. Shell Programming and Scripting
How can I use sed to replace a ctrl character such as 'new line' (\0a) to something else? Or any other good command can do this job?
Thanks,
Hillxy (5 Replies)
Discussion started by: hillxy
5 Replies