3
votes
5answers
128 views

Get values block by block in same file

I have a file say "SAMPLE.txt" with following content, P1 10,9:6/123456 P2 blah blah P1 10,9:5/98765 P2 blah blah P1 blah blah P2 I want a output file say "RESULT.txt" as, Value1:123456 ...
1
vote
1answer
64 views

Using kornshell or Perl to circumvent permissions needed by root

I have a problem where I need to change the ownership and permissions of one file that exists on more than 200 servers. I belong to 2 different groups and need to change the ownership from one group ...
1
vote
3answers
298 views

Print the last-but-one field

How to print the word before the last word in line (with ksh or awk or sed or perl one liner) Example 1: echo one two three will print "two" Example 2: echo 1 2 3 4 5 6 will print "5"
0
votes
2answers
250 views

perl one liners + match word and delete string after separator

I work with linux/solaris machines and I need to add some rule in my ksh script: Please advise how to match the password word in file, and delete the value password after the separator "=" with perl ...
0
votes
1answer
229 views

perl one liners + print line if match last word but with space

The following perl syntax will print the line in case line was ended with "DUPLEX" But Sometimes DUPLEX have one space or more as "DUPLEX " so in this case line will not printed Please ...
2
votes
1answer
238 views

how to replace IP address on remote host using expect

I wrote the following expect script in order to replace the IP address on remote Linux machine I use a perl one-liner for this task I get errors about can't read "HOME": no such variable , Please ...
1
vote
1answer
484 views

How to filter an array of strings in ksh

Please advise what's wrong in my ksh code. I want to remove the IP's as defined in "bb" array from "aa" array so the IP's 255.0.0.0 and 255.255.255.0 will be removed from the list in aa array. When ...
2
votes
2answers
139 views

ksh + delete number from string

the string IP include some IP address numbers as the following example echo ${IP[*]} 192.9.200.1 192.9.200.2 192.9.200.3 is it possible to remove some IP address number from the list ( using ksh ...
1
vote
2answers
253 views

perl one liner + how to match IP address that located in the first/sec field of file

the following perl one liner syntax verify if IP address in "$IP" match the IP ADDRESS in file perl -ne 'BEGIN{$IP=shift} print if /(^|\s)\Q$IP\E(\s|$)/;' $IP file file have two fields as the ...
2
votes
2answers
147 views

linux & solaris - separate netmask IP's from ordinary IP's

I have file with IP address and netmask IP's my target is to cut the netmask IP's from the file_with_IPs.txt and paste them to another file as file_with_only_netmask_ips.txt remark - netmask IP can ...
-3
votes
4answers
553 views

perl one liner + how to replace any last IP address octets

How to replace any last IP address octets (four octet ) to 0 remark: Implementation should be by Perl one linear on linux machines for example 192.9.200.124 will replaced to 192.9.200.0 ...
0
votes
3answers
394 views

Sorting IP address according to the second field in file

in my ksh script I need to add the following task ( OS - linux/solaris ) I have the following file more test.txt /etc/backup/app 172.1.120 172.110.120 /etc/backup/app 172.1.120.12 ...
0
votes
2answers
101 views

perl one liner + print VALUE in the end of the line

The following perl one liner checks if $CURRENT_VERSION matches $NEW_VERSION exactly, and prints it if it does. Example: CURRENT_VERSION=223.3.12.4.5.3 NEW_VERSION=223.3.12.4.5.3 DATE=17.3.2013 ...
0
votes
1answer
649 views

Rename files and directories with a special characters on solaris machines

The target of the following code ( commands ) is to rename files/directories and also support files/directories with a special characters as "@" or "." etc those commands are run fine on Linux ...
1
vote
3answers
532 views

linux/solaris + verify duplicate valid IP address from file

what the best way to find duplicate IP from file ( I have ksh script in this script I need to write function that check for duplicate IP ) for example if IP - 192.1926.23.52 exists twice in file - ...
1
vote
1answer
574 views

Linux + replace STRING/WORD in file according to rule

My target is to replace any word/string/Any characters in file with new word/string according to the following rules: If numeric characters on the left side of word/string then we not replace the ...
0
votes
1answer
378 views

linux + perl + replace any WORD in file with special characters with condition

Example1 work fine when I want to replace OLD_TEXT with NEW_TEXT ( its replace also all special characters as $@^%)(_+`:; etc ..) example1 export OLD_TEXT='$$OLD_WORD$$' export ...