10-18-2009
Inline searc and replace inside file
Hello,
I have a text file that i want to redirect into a new file , searching and replacing certain string during the opertaion.
This should be done using shell script , so it should not be interactive.
The script should get four parameters :
source file
target file
source string
target string
For example :
source file = a.txt
target file = b.txt
source string = apple
target string = banana
Sorce Text file a.txt contain:
=================
Hellow apple
target text file should contain the following result
=======================================
Hellow banana
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
<c-param>
<param-name>Number</param-name>
<param-value>22</param-value>
<description>my house number</description>
</c-param>
<c-param>
<param-name>Address</param-name>
... (4 Replies)
Discussion started by: reldb
4 Replies
2. Programming
#include <iostream>
using namespace std;
class A
{
public:
int Getvalue() { return i;}
private:
int i;
};
int main()
{}
The above code compiles properly in g++ or in any other C++ compiler.
BUT, the variable 'i' is used (in 'return i' statement) before it is... (1 Reply)
Discussion started by: deepthi.s
1 Replies
3. Shell Programming and Scripting
i need to log the feedback from the ftp server as i'm performing some deletes.
the only way i know of to do this is with the inline redirect << EOF
... but from there to the closing EOF, it's like i'm at the ftp command prompt, so I don't know how to have ksh script logic in there
I have an... (3 Replies)
Discussion started by: tlavoie
3 Replies
4. Shell Programming and Scripting
Hi,
I have a situation where I want to replace some occurrences of ".jsp" into ".html" inside a text file.
For Example:
If a pattern found like <a href="http://www.mysite.com/mypage.jsp"> it should be retained.
But if a pattern found like <a href="../mypage.jsp"> it should be changed to... (4 Replies)
Discussion started by: meharo
4 Replies
5. Shell Programming and Scripting
hello everybody,
I have a group of file
eg-
sample1
sample2
sample3
sample4
each file contain this :-
cat sample1
SEQ_NUM,1,UPESI1
My requirement is to
change the value-UPESI1 to UPE10 in file which contain this pattern -UPESI1.
any help is appreciated. (2 Replies)
Discussion started by: abhigrkist
2 Replies
6. Shell Programming and Scripting
Hi All,
I want to change the name as SEQ_13
ie., <Property Name="Name">SEQ_13</Property>
when the Stage Type is PxSequentialFile
ie., <Property Name="StageType">PxSequentialFile</Property> :wall:
Input.XML
<Main>
<Record Identifier="V0S13" Type="CustomStage" Readonly="0">... (3 Replies)
Discussion started by: kmsekhar
3 Replies
7. Shell Programming and Scripting
I have file file_1.out which contains the data below
<tr> MAIL # 1 TO src_1 </tr>
<tr><td class="hcol">col_id</td> <td class="hcol">test_dt</td> <td class="hcol">user_type</td> <td class="hcol">ct</td></tr>
<tr><td class="bcol">1</td> <td class="bcol">2012-09-20</td> <td class="bcol">A</td>... (4 Replies)
Discussion started by: sol_nov
4 Replies
8. Shell Programming and Scripting
Hello,
Iam a newbies to Shell scripting. Iam trying to replace the date inside the file to new date. is there anyway that we can just use the pattern to search as "..." I have many files want to replace with the same date, and each file contains different date.
Thanks for your help.
... (2 Replies)
Discussion started by: Daro
2 Replies
9. Shell Programming and Scripting
How can I change the comma sign (,) to plus sign (+) with the sed command or any regex?
I mean to change only the comma that beteen the quotation marks.
From this file:
A,B,C
A,"B,C",D
"A,B",C,D
A,B,"C,D"
To this file:
A,B,C
A,"B+C",D
"A+B",C,D
A,B,"C+D" (6 Replies)
Discussion started by: elior
6 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I need to write a script to find all "*.sh" files in /home file system and if any string find "*.sh" files with the name vijay@gmail.com need to replace with vijay.bhaskar@gmail.com. I just understood about the find the command to search .sh files. Please help me on this.
find / -name... (3 Replies)
Discussion started by: bhas85
3 Replies
LEARN ABOUT CENTOS
sepolicy-communicate
sepolicy-communicate(8) sepolicy-communicate(8)
NAME
sepolicy-communicate - Generate a report showing if two SELinux Policy Domains can communicate
SYNOPSIS
sepolicy communicate [-h] -s SOURCE -t TARGET [-c TCLASS] [-S SOURCEACCESS] [-T TARGETACCESS]
DESCRIPTION
Use sepolicy communicate to examine SELinux Policy to if a source SELinux Domain can communicate with a target SELinux Domain. The default
command looks to see if there are any file types that the source domain can write, which the target domain can read.
OPTIONS
-c, --class
Specify the SELinux class which the source domain will attempt to communicate with the target domain. (Default file)
-h, --help
Display help message
-s, --source
Specify the source SELinux domain type.
-S, --sourceaccess
Specify the list of accesses used by the source SELinux domain type to communicate with the target domain. Default Open, Write.
-t, --target
Specify the target SELinux domain type.
-T, --targetaccess
Specify the list of accesses used by the target SELinux domain type to receive communications from the source domain. Default Open,
Read.
AUTHOR
This man page was written by Daniel Walsh <dwalsh@redhat.com>
SEE ALSO
sepolicy(8), selinux(8)
20121005 sepolicy-communicate(8)