10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i am having file like this
#!/bin/bash
read -p 'Username: ' uservar
match='<color="red" />'
text='this is only a test
so please be patient
<color="red" />'
echo "$text" | sed "s/$match/&$uservar\g"
so desireble output what i want is if user type MARIA
this is only a test
so please... (13 Replies)
Discussion started by: tomislav91
13 Replies
2. UNIX for Beginners Questions & Answers
Hi
How do I print character after colon":"
below is input file
BUC1 : 33157147, BUC1 COUNT : 478455,BUC1 : 9930334.18
BUC2 : 1203100,BUC2 COUNT : 318678,BUC2 GIVEN : 3493491.59
BUC3 : 234567.99 expected output
33157147 478455 9930334.18
12031002 318678 3493491.59
234567.99 (10 Replies)
Discussion started by: scriptor
10 Replies
3. Shell Programming and Scripting
Dear all,
I would like to insert N blankspaces in front of a string using sed command
To give an example (N=10), I tried that code:
$ echo "abcd" | sed 's/^/ \{10,\}&/'
but I failed, by obtaining that result:
{10,}abcd
Any help would be greatly appreciated,
Thanks in advance,... (18 Replies)
Discussion started by: dae
18 Replies
4. Shell Programming and Scripting
I need to read a text file and insert a string every n lines, but also have the line counter restart when I come across a header string.
Line repeating working every 3 lines using code:
sed '0~3 s/$/\nINSERT/g' < INPUT/PATH/FILE_NAME.txt > OUTPUT/PATH/FILE_NAME.txt
I cannot seem to find... (1 Reply)
Discussion started by: Skonectthedots
1 Replies
5. Shell Programming and Scripting
Hi,
I would like to know how, using sed, be able to insert contents of file2 in file1 after say the second occurrence of a given string? e.g.
> cat file1
banana
apple
orange
apple
banana
pear
tangerine
apple
> cat file2
I don't like apples
What would be the sed command to insert... (5 Replies)
Discussion started by: dimocn
5 Replies
6. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
7. UNIX for Dummies Questions & Answers
Hi:
I have 2 files: teststring.txt and a tempfile.txt
teststring file contains:
s/Primary Ins./\n1/g
I'm trying to search for "Primary Ins." string in tempfile. For every "Primary Ins." string that is found, a new line is inserted and put in number 1. Then, write out the newfile... (7 Replies)
Discussion started by: newbeee
7 Replies
8. Shell Programming and Scripting
Hi,
Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g.,
# vs="echo a; echo b;"
# $vs
a; echo b;
I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using... (2 Replies)
Discussion started by: svhyd
2 Replies
9. Shell Programming and Scripting
If the string is of the pattern XxxXyzAbc...
The expected out put from sed has to be Xxx Xyz Abc ...
eg: if the string is QcfEfQfs, then the expected output is Qcf Ef Efs.
If i try to substitute the pattern with space then the sed will replace the character or pattern with space,... (1 Reply)
Discussion started by: frozensmilz
1 Replies
10. Shell Programming and Scripting
"are you billy_smith ?"
replace with
"are you billy_smith ?
my name is billy_smith"
how to fetch the name "billy_smith" and using it later
I need sed script to do this, any one can help? Thanks (6 Replies)
Discussion started by: playinmel.com
6 Replies