12-14-2003
my script does no work .....
#!/bin/ksh
file_name=$1
old_templet=$2
new_templet=$3
# Loop through every file like this
for file in $file_name
do
cat $file | sed "s/$new_template/$old_template/g" > $file.new
#do a global searce and replace and put the results
mv $file.new $file
#rename $file.new to original name of file
done
i try to run it from the command line, but it does not work.
any idea ???
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I get a text file with 70+ columns (seperated by Tab) and about 10000 rows. The 58th Column is all numbers. But sometimes 58th columns has "/xxx=##" after the numeric data. I want to truncate this string using the script. Any Ideas...:confused: (3 Replies)
Discussion started by: gagansharma
3 Replies
2. Shell Programming and Scripting
Looking for a way using sed/awk/perl to replace port numbers in a file with an incrementing number. The original file looks like...
Host cmg-iqdrw3p4
LocalForward *:9043 localhost:9043
Host cmg-iqdro3p3a
LocalForward *:10000 localhost:10000
Host cmg-iqdro3p3b
LocalForward... (2 Replies)
Discussion started by: treadwm
2 Replies
3. Shell Programming and Scripting
Trying to create a script/executable to replace "abc" text string in "myfile.htm" with input from a pop-up field. For example, launch this thing and a prompt is popped up asking the user to input what "abc" should be replaced with, then it inserts what the user inputs in place of abc in the... (3 Replies)
Discussion started by: mike909
3 Replies
4. Shell Programming and Scripting
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies
5. Shell Programming and Scripting
Hi,
I am creating a script to do a find and replace single/multiple lines in a file with any number of lines.
I have written a logic in a script that reads a reference file say "findrep" and populates two variables $FIND and $REPLACE
print $FIND gives
Hi How r $u
Rahul()
Note:... (0 Replies)
Discussion started by: r_sarnayak
0 Replies
6. Shell Programming and Scripting
Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ?
The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories.
So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Discussion started by: spfc_dmt
12 Replies
7. Shell Programming and Scripting
Hi All,
I have a unix shell script file as below.
My task is
a)to replace 248 to 350 and need to create a new file as BW3_350.sh
b)to replace 248 to 380 and need to create a new file as BW3_380.sh
c)to replace 248 to 320 and need to create a new file as BW3_320.sh
there is no... (6 Replies)
Discussion started by: karthi_mrkg
6 Replies
8. UNIX for Dummies Questions & Answers
I am making an eBook.
I am editing the html in BBedit.
I need to replace all <p class="s5"> with just a <p>.
How do I write this for GREP?
Thank you,
Abby (5 Replies)
Discussion started by: cuddlykitty
5 Replies
9. UNIX for Dummies Questions & Answers
Hi
I am looking to rename the contents of this dir, each one with a new timestamp, interval of a second for each so it the existing format is on lhs and what I want is to rename each of these to what is on rhs..hopefully it nake sense
CDR.20060505.150006.gb CDR.20121211.191500.gb... (3 Replies)
Discussion started by: rob171171
3 Replies
10. UNIX for Dummies Questions & Answers
I have text with upper and lower case words. I want to find something and replace it with something new. But it should match the case - Meaning - it should replace old upper cased word with NEW upper case word and lower with lower.
example:
this text is very simple TEXT.
now I want to replace... (5 Replies)
Discussion started by: grep_me
5 Replies
LEARN ABOUT DEBIAN
sestatus.conf
sestatus.conf(5) sestatus configuration file sestatus.conf(5)
NAME
sestatus.conf - The sestatus(8) configuration file.
DESCRIPTION
The sestatus.conf file is used by the sestatus(8) command with the -v option to determine what file and process security contexts should be
displayed.
The fully qualified path name of the configuration file is:
/etc/sestatus.conf
The file consists of two optional sections as described in the FILE FORMAT section. Whether these exist or not, the following will always
be displayed:
The current process context
The init process context
The controlling terminal file context
FILE FORMAT
The format consists of two optional sections as follows:
[files]
file_name
[file_name]
...
[process]
executable_file_name
[executable_file_name]
...
Where:
[files]
The start of the file list block.
file_name
One or more fully qualified file names, each on a new line will that will have its context displayed. If the file does not
exist, then it is ignored. If the file is a symbolic link, then sestatus -v will also display the target file context.
[process]
The start of the process list block.
executable_file_name
One or more fully qualified executable file names that should it be an active process, have its context displayed. Each entry
is on a new line.
EXAMPLE
# /etc/sestatus.conf
[files]
/etc/passwd
/etc/shadow
/bin/bash
/bin/login
/lib/libc.so.6
/lib/ld-linux.so.2
/lib/ld.so.1
[process]
/sbin/mingetty
/sbin/agetty
/usr/sbin/sshd
SEE ALSO
selinux(8), sestatus(8)
Security Enhanced Linux 26-Nov-2011 sestatus.conf(5)