Hi All,
I am searching for IP address pattern in some files which I want to replace with some characters. However when I replace the IP numbers, it also replaces other characters beyond the IP address like below-
125.29.234.18.23456->SSS.SS.SSS.SS.SSSSS
In the above example it should not replace the 23456 with the new characters. It should be-
125.29.234.18.23456->SSS.SS.SSS.SS.23456
this thing I am doing with awk in ksh. I don't know how to specify word boundary for this IP address so that only 4 numbers separated by 3 dots which form the the IP address should be replaced with the characters.
Hi Don,
yes, I dnt want to replace the last number coming after the 4 numbers forming the IP address. So the replacement should consider only the first 4 numbers forming the IP and should replace it, not the number coming beyond it. So the replacement should be like this-
ip1 -> 10.145.234.176.45645-> SS.SSS.SSS.SSS.45645
ip2-> 125.15.234.9.3456->SSS.SS.SSS.S.3456
hope you understand my point.
thanks for your reply
The string:
is not an IP address. It might be two IP addresses separated by "->" although I have never seen IP addresses that contained letters instead of digits.
Show us you input (using CODE tags) and state what it is. (I.e., Is it stored in a shell variable? Is it a line in an input file? Is it something else?)
Then show us the output you are trying to produce using CODE tags. Make positive statements like: I want to change x to y. Stating a negative (I don't want to replace the last number.) doesn't really help if we don't know what you do want to do.
It may also help if you tell us what shell and OS you're using.
Hi,
Say, I have a file containing 'netstat -an' output like below -
I want to replace only the IP address 10.108.231.140 to some letter/character. If you see this pattern 10.108.231.140.33099 which represents some_ip.port_no. I want to replace only the IP address leaving the port no unchanged.
Below sample code replaces all ip with port no pattern without considering the exact IP address pattern.
So can you please tell me how to get output like below-
As you see, only the IP address is replaced with a Letter. I want this as the desired result.
This I am doing on Solaris using ksh and awk. So I can't use perl for this, because I want this in korn script only.
thanks for your valuable replies.
You could try something like the following:
Note that on Solaris systems, /usr/xpg[46]/bin/sh are Korn shells, but there is nothing in this script that requires Korn shell extensions Any shell that accepts basic Bourne shell syntax will be fine for this script.
I have a multicolumn text file with header in the first row like this
The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach
for ii in ${hdr}
do
gawk -vcol="$ii" -F... (1 Reply)
Hi Help,
I am trying to create something like ---
Suppose, I have grid origin at X=600000.0 & Y=90000.0.
For any values of X, Y values lying within a circular periphery defined by circle of radius R=500m;X=599500.0 & 600500.0 ;Y=90500.0 & 89500.0should have a default=0or else it should... (4 Replies)
Hi Guys,
Another questions to the genius over here. I have spool the dataf from the database into a .csv file. But can it be possible to have all the rows and column with the boundaries..for example the .csv file which i have is as below:
20140327 BU 9A 3
20140327 SPACE 9A 3
20140327... (8 Replies)
hi Guys ..
user want mirror disk c3t9d0 (running ) to c2t9d0 (fresh hdd).
when i tried to
bash : prtvtoc /dev/rdsk/c3t9d0s2 | fmthard -s- /dev/rdsk/c2t9d0s2
it showing following error
Partition 0 not aligned on cylinder boundary: " 0 4 222 .....
unable to mirror ....
plz... (1 Reply)
Hi,
I have tcp/ip client server programs which will communicate through reqest,reply c-structures.
As the sizeof(struct) may give different value between client and server programs, how do i align properly for boundary conditions.
Could anybody please give some suggestion.
Thanks in... (3 Replies)