09-20-2007
Replacing all instances of an IP address in a log file.
I know this should be simple but the periods in the string replacement are throwing me off.
What I want to do is replace 1.1.1.1 in my access.log file with 2.2.2.2
I have tried using 'tr' but its being thrown off by the periods and replacing all sorts of stuff in the file.
What do I need to do to just have something run through the whole file replacing any instance of one ip address with another?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am capturing text based reports with a specific program, which works no problem. However, since I send report warehouse output as they are migrated from the database software, on occasion when two capture process' initiate simultaneously, the capture file locks up. Is there a way to setup (in... (1 Reply)
Discussion started by: gozer13
1 Replies
2. Shell Programming and Scripting
Hi experts,
I am new to scripting. I have a requirement as below.
File1:
A|123|NAME1
A|123|NAME2
B|123|NAME3
File2:
C|123|NAME4
C|123|NAME5
D|123|NAME6
1) I have 2 merge both the files.
2) need to do a sort ( key fields are first and second field)
3) remove all the instances... (3 Replies)
Discussion started by: vukkusila
3 Replies
3. Shell Programming and Scripting
Hello Im new here.I need to replace strings and change it into csv format, or at least saves the file as csv if that would work :p. Heres an example of my scenario
1) I have a log file, named abc.log, and its like a txt based file anyway, and the content looks like this
... (2 Replies)
Discussion started by: tententen
2 Replies
4. Shell Programming and Scripting
Hi,
I have a set of files stored in a single directory that I use to set parameters for a physics code, and I would like to streamline the process of updating them all when I change a parameter. For instance, if the files are called A2000p300ini, A2000p300sub, A2000p300run, and the text in each... (3 Replies)
Discussion started by: BlueChris
3 Replies
5. UNIX for Dummies Questions & Answers
In my command prompt I did:
sed 's/\://' mytextfile > newtextfile
But it only deleted the first instance of : in each line when some lines have multiple : appearing in each one. How can I delete all the : from the entire file? (1 Reply)
Discussion started by: guitarscn
1 Replies
6. UNIX and Linux Applications
hello -
A SystemOut.log file has recurring entries that follow this format:
Principal: auth9.nick.al.gov:389/USERNAME
Over the course of a day thousands of lines similar to this are produced, with each username represented hundreds of times.
I need to create a new file that shows... (4 Replies)
Discussion started by: 1075FJ40
4 Replies
7. Shell Programming and Scripting
Hi I have some script like this:
perl -i -p0e 's/"keyword1-.*?"/"keyword2"/s' file
to replace some keyword, but it replaces only the first instance of the keyword
how can i get it to replace all instances?
thanks! (2 Replies)
Discussion started by: vanessafan99
2 Replies
8. Shell Programming and Scripting
I have a log file with several IP addresses in it:-
2012-12-06 16:05:05,885 NOTICE **SNMP** Alarm was created: (LicenseClientRejected) Client Remote Peer /125.111.64.125:2573 was
Rejected Property=/125.111.64.125:2573, Client Remote Peer /125.111.64.125:2573 was
Rejected **SNMP**.... (5 Replies)
Discussion started by: BHM
5 Replies
9. Shell Programming and Scripting
Hi
I need to move one file from source path to target path .Before moving , I need to go to target path and delete the files having certain naming convention in that particular month . So at any point of time while moving i should have only one file . Is there any command that can do this if... (4 Replies)
Discussion started by: Hypesslearner
4 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I have a requirement to get the address values from a large log file along with the user details.
line1,line2,city,stateCode,postalCode,countryCode. The below code as advised in the earlier post is giving the user data
zgrep -B1 "Failed to calculate Tax" log.2018-05-23.gz | grep... (8 Replies)
Discussion started by: nextStep
8 Replies
LEARN ABOUT HPUX
annuityl
annuity(3M) annuity(3M)
NAME
annuity(), annuityf(), annuityl(), annuityw(), annuityq() - present value factor for annuity
SYNOPSIS
DESCRIPTION
The function computes the present value factor for an annuity:
(1 - (1 + rate) ** (-periods)) / rate
is a version of it takes arguments and returns a result.
is a version of it takes arguments and returns a result.
is an version of it takes arguments and returns an result.
is equivalent to on HP-UX systems.
USAGE
To use these functions, compile either with the default option or with the and options. To use compile with the option. Make sure your
program includes Link in the math library by specifying on the compiler or linker command line.
RETURN VALUE
If periods equals zero, returns 0.0.
Else, if rate equals zero, returns periods.
Else, if either argument is a NaN, returns a NaN.
Else, if rate < -1, returns a NaN and raises the invalid exception.
Else, if rate = -1 and periods = +INFINITY, returns +INFINITY.
Else, if rate equals -1 and periods > 0, is equivalent to
Else, if rate equals -1, returns -1.
Else, if rate equals +INFINITY and periods >= 0, returns +0.0.
Else, if rate equals +INFINITY and -1 < periods < 0, returns -0.0.
Else, if rate equals +INFINITY and periods = -1, returns -1.
Else, if rate equals +INFINITY, returns -INFINITY.
Else, if periods is infinite and (rate * periods) > 0, is equivalent to
Else, if periods is infinite, returns periods.
returns a properly signed infinity in lieu of a value whose magnitude is too large, and raises the overflow and inexact exceptions.
raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or zero) and thereby suffers loss of accuracy,
and may raise those exceptions if the result is merely tiny.
ERRORS
No errors are defined.
SEE ALSO
compound(3M), exp(3M), expm1(3M), pow(3M), math(5).
STANDARDS CONFORMANCE
These functions are not specified by any standard.
HP Integrity Server Only annuity(3M)