10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a script that replaces one string with the other in all files under the specified directory.
!/bin/bash
# **************** Change Variables Here ************
startdirectory="/opt/app/properties/tmp_new"
searchterm="Oracle/Middleware/"
replaceterm=""
#... (1 Reply)
Discussion started by: mohtashims
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I want to use a code like
sed -n "1,9988p" filename | wc -l
I tried
from=1
till=9988
sed -n "/$from/,/$till/p" filename |wc -l
Issue:
sed -n "1,9988p" filename | wc -l -- Returns 9988 rows
But
sed -n "/$from/,/$till/p" filename |wc -l # Returns > 9988 rows(Complete file)
I... (2 Replies)
Discussion started by: Gurkamal83
2 Replies
3. Shell Programming and Scripting
Hi All,
I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command.
The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies
4. Shell Programming and Scripting
I have a file that contains lines like this:
allgroups: cn=Role1,cn=groups,o=xyz,st=mn,c=us
allgroups: cn=Role1,cn=groups,o=xyz,st=mn,c=us
I want to remove the string :
,cn=groups,o=xyz,st=mn,c=us
and so I tried to use SED. i tried to assign it to a variable and use it:
... (3 Replies)
Discussion started by: vskr72
3 Replies
5. Shell Programming and Scripting
I need to search for a keyword UTF-16 in a list of files if that keyword is found then i need to convert the file to UTF-8 format using iconv command.
After this i should substitute the UTF-16 keyword inside the file to UTF-8.
Please suggest how to do this in shell scripting. (11 Replies)
Discussion started by: Shruthi8818
11 Replies
6. UNIX for Dummies Questions & Answers
I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename?
#!/bin/bash
filename=`echo $0`
/usr/bin/sed '/#include/ {
i\
the filename is `$filename`
}' $1
exit 0 (8 Replies)
Discussion started by: glev2005
8 Replies
7. Shell Programming and Scripting
Hi everybody,
I have come across a typical problem:
I need to use sed command to replace an apostrophe but it is saying no match found in the error
sed -e 's/`/'/g' ...but it is not working. Can you please tell me how to use this apostrophe in this sed command please. Thanks.
Rubin (8 Replies)
Discussion started by: RubinPat
8 Replies
8. UNIX Desktop Questions & Answers
Hi,
I have to replace the character AL2 with AL16 which I have in one of my text file .
I used the sed command like this
sed 's/sed 's/AL2/AL16/g' test_carr.dat>test_carr1.dat
But it is not replacing this value to the output file.
The test_carr.dat file contains data like this
cat... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies
9. Shell Programming and Scripting
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies
10. Shell Programming and Scripting
I'm writting a krn shell script and i'm having an issue with a variable using sed.
If someone enters a variable with a " /" the sed command doesn't read it right.
example.
a='12000/10-DC'
b='12000/10-AC'
cat file | sed "s/$a/$b/"
How can i correct this issue? Will the fix to this... (2 Replies)
Discussion started by: wisher115
2 Replies