Sponsored Content
Full Discussion: Use of sed inside perl
Top Forums Shell Programming and Scripting Use of sed inside perl Post 302957892 by Tuxidow on Friday 16th of October 2015 07:17:18 AM
Old 10-16-2015
Use of sed inside perl

Code:
$string="test.binary.value";
$toggle="test.binary.value=true";
host=test.server.com

my $returnCode = system ( "ssh $host 'cp -p /tmp/testfile /tmp/testfile.bkup; sed -i 's/\$string.*/\$toggle/g' /tmp/testfile'" );

cat testfile

test.binary.value=false

Scenario: I am trying to change the value of that binary to true from false. The user provides $toggle as an argument to the perl script. I want to change the line what ever be the previous line in the file to what user entered. Its like search and replace.

The above is my code but its not working, but its simply making the file empty/null. I am not sure whats the mistake I am making. Any help would be greatly appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Perl Inside KSH

Hi there, I am new to Perl and KSH. The system I am using picks up the KSH scripts and uses them in a batch job control system. I am trying to set a variable from a perl command #!/bin/ksh -eaxp #******************************************************************************* # Testing... (5 Replies)
Discussion started by: SaadLive
5 Replies

2. UNIX for Dummies Questions & Answers

SED inside while loop

Hi, im having problem creating a loop using my code: aside from the fact that the 1st variable (VAR) does not increment, it loops more than the expected output. for sample purposes, test csv contains 3 lines. #get number of lines in the file lines=$( wc -l < test.csv ) ... (5 Replies)
Discussion started by: paoie
5 Replies

3. Shell Programming and Scripting

PERL: an OR inside an IF .. im stuck

Hi all, I basically have an if statement that says if you have more than 5 changes you need to have the force flag set to 1 to proceed. like this if ((($Changes > 5) && ($force == 1)) || (($nChanges > 0) && ($Changes < 6))) { I now need to allow the force flag to be either 1 or 2 to... (2 Replies)
Discussion started by: rethink
2 Replies

4. Shell Programming and Scripting

Need help using sed inside the loop.

Hi, i have written a script. it collects data based on the sql queries executed by it. i have multiple output files. after the output file is made i need to do some cosmetic changes in the files and then store them. i am unable to use sed conditions inside the loop. see below code for... (3 Replies)
Discussion started by: dazdseg
3 Replies

5. Shell Programming and Scripting

sed inside sed for replacing string

My need is : Want to change docBase="/something/something/something" to docBase="/only/this/path/for/all/files" I have some (about 250 files)xml files. In FileOne it contains <Context path="/PPP" displayName="PPP" docBase="/home/me/documents" reloadable="true" crossContext="true">... (1 Reply)
Discussion started by: linuxadmin
1 Replies

6. Shell Programming and Scripting

Variable inside sed

Problem: Need to read contents from a file and use that value inside sed as avariable. sample code below. THe below code replaces contents inside file123 for matched string with "$x" value only. but we want the value of x which is read from TextFile.txt to go in there. cat TextFile.txt|while... (3 Replies)
Discussion started by: cvsanthosh
3 Replies

7. Shell Programming and Scripting

Perl inside shell

I am trying to find out the difference between two dates, for which I am using perl inside SHELL. Below are my codes. perl -MDate -e 'Date::Calc qw(Delta_DHMS);' perl -e '($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($year1,$month1,$day1, $hour1,$min1,$sec1, $year2,$month2,$day2, $hour2,$min2,$sec2)' But... (6 Replies)
Discussion started by: sauravrout
6 Replies

8. UNIX for Dummies Questions & Answers

Array inside sed

Hi guys Let me at first describe the whole thing that I'm trying to do. Lets say I have 100 files like the following one. Ow 1230 16.000000 -0.834000 16.083957 1.751652398 -17.20094528 -4.450623277 Hw 1231 ... (6 Replies)
Discussion started by: saleheen
6 Replies

9. Shell Programming and Scripting

Rewrite sed to perl or run sed in perl

I am having trouble re-writing this sed code sed -nr 's/.*del(+)ins(+).*NC_0{4}(+).*g\.(+)_(+).*/\3\t\4\t\5\t\1\t\2/p' C:/Users/cmccabe/Desktop/Python27/out_position.txt > C:/Users/cmccabe/Desktop/Python27/out_parse.txt in perl Basically, what the code does is parse text from two fields... (12 Replies)
Discussion started by: cmccabe
12 Replies

10. Shell Programming and Scripting

Using sed inside shellscript

Hi All, I am trying to use sed command inside a shell script. The same sed command is working on command line, however its not working while using inside a shell script. From various sources i found , it could be done by using -i option, but its not working as well. sed... (11 Replies)
Discussion started by: gotamp
11 Replies
sigtool(1)							  Clam AntiVirus							sigtool(1)

NAME
sigtool - signature and database management tool SYNOPSIS
sigtool [options] DESCRIPTION
sigtool can be used to generate MD5 checksums, convert data into hexadecimal format, list virus signatures and build/unpack/test/verify CVD databases and update scripts. OPTIONS
-h, --help Output help information and exit. -V, --version Print version number and exit. --quiet Be quiet - output only error messages. --stdout Write all messages to stdout. --hex-dump Read data from stdin and write hex string to stdout. --md5 [FILES] Generate MD5 checksum from stdin or MD5 sigs for FILES. --mdb [FILES] Generate .mdb signatures for FILES. --html-normalise=FILE Create normalised HTML files comment.html, nocomment.html, and script.html in current working directory. --utf16-decode=FILE Decode UTF16 encoded data. --vba=FILE Extract VBA/Word6 macros from given MS Office document. --vba-hex=FILE Extract Word6 macros from given MS Office document and display the corresponding hex values. -i, --info Print a CVD information and verify MD5 and a digital signature. -b, --build Build a CVD file. -s, --server is required. --server ClamAV Signing Service address (for virus database maintainers only). --unpack FILE, -u FILE Unpack FILE (CVD) to a current directory. --unpack-current Unpack a local CVD file (main or daily) to current directory. --diff=OLD NEW, -d OLD NEW Create a diff file for OLD and NEW CVDs/INCDIRs. --run-cdiff=FILE, -r FILE Execute update script FILE in current directory. --verify-cdiff=FILE, -r FILE Verify DIFF against CVD/INCDIR. -l[FILE], --list-sigs[=FILE] List all signature names from the local database directory (default) or from FILE. -fREGEX, --find-sigs=REGEX Find and display signatures from the local database directory which match the given REGEX. The whole signature body (name, hex string, etc.) is checked. -fREGEX, --decode-sigs=REGEX Decode signatures read from the standard input (eg. piped from --find-sigs) -fREGEX, --test-sigs=DATABASE TARGET_FILE Test all signatures from DATABASE against TARGET_FILE. EXAMPLES
Generate hex string from testfile and save it to testfile.hex: cat testfile | sigtool --hex-dump > testfile.hex CREDITS
Please check the full documentation for credits. AUTHOR
Tomasz Kojm <tkojm@clamav.net> SEE ALSO
freshclam(1), freshclam.conf(5) ClamAV 0.96.1 February 12, 2007 sigtool(1)
All times are GMT -4. The time now is 11:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy