Search Results

Search: Posts Made By: mohtashims
Forum: Shell Programming and Scripting 17 Minutes Ago
4
Posted By mohtashims
Need grep regex to extract multiline text between two strings
I have a file conatining the below:

---
10.9.16.116:
/tmp/5835113081224811756.jar:
hash: e6df90d38fa86f0e289f73d79cd2cfd2a29954eb
/tmp/4603745991442278706.jar:
hash:...
232
Posted By mohtashims
I need regex solution for grep and not sed as i...
I need regex solution for grep and not sed as i m using a tool called Ansible which has a module called as "lineinfile" module which i guess uses underlying python to interpret the regex.

I use...
232
Posted By mohtashims
Search for a text between two strings in a file using regex
Here is my sample file data:



My requirement is to have a regex expression that is able to search for visible starting string "SSLInsecureRenegotiation Off" between strings "<VirtualHost " and...
300
Posted By mohtashims
Thank you as it helped resolve the problem.
Thank you as it helped resolve the problem.
179
Posted By mohtashims
Make a copy of a file when someone tries to modify the file
I wish to take a backup of the file when someone tries to modify a file say /tmp/test.txt using vi, vim, cat, copy, mv commands.

I'm aware of inotify which will notify me of any changes to the...
300
Posted By mohtashims
@Rudic thank you for the explanation. Let's...
@Rudic thank you for the explanation.

Let's consider a sample file like below:


530 #Include conf/extra/httpd-ssl.conf
531
532 Include conf/extra/httpd-ssl.conf
...
300
Posted By mohtashims
Given the sample data i expect regex to return...
Given the sample data i expect regex to return NOTHING it should NOT MATCH anything but unfortunately it does.

Mine is a Oracle Linux system.
300
Posted By mohtashims
Need regex for line not starting with hash #
I need to search for lines starting with "Include" and later has string "httpd-ssl.conf"

like the regex should return match for "Include conf/extra/httpd-ssl.conf"

I tried the following:
...
616
Posted By mohtashims
I have your code as you gave with no changes. I...
I have your code as you gave with no changes. I never skipped cut -f2- but not sure why is it not kicking in for me. Any guesses ?

Not sure if this is concerning but in my output you can see this...
616
Posted By mohtashims
This output is how i want but do you see the...
This output is how i want but do you see the output that i get. It has serial number printed matching the number of ips i.e
0
0
0
1
1
1
2
2
3
.... And so on
before the needed data on...
616
Posted By mohtashims
@Rudic can you tell me where do you exactly store...
@Rudic can you tell me where do you exactly store the final sorted output in a file or variable? Because that is what i m looking for. Here is your exact code with the unexpected output as is.

$...
616
Posted By mohtashims
@Rudic i tried your solution: However, I do...
@Rudic i tried your solution:

However, I do not get the desired output. Below is how i debug your code:


iplist=$1
declare -A IPASS
IFS=,
for i in $iplist;
do
echo "Value is:$i"...
616
Posted By mohtashims
I will check on this tomorrow and update if it...
I will check on this tomorrow and update if it works
Forum: Shell Programming and Scripting 2 Weeks Ago
616
Posted By mohtashims
awk often errors with too long string message...
awk often errors with too long string message hence would appreciate non seek solution. Also if the solution is on the lines of the code i shared it would be really great.
Forum: Shell Programming and Scripting 2 Weeks Ago
616
Posted By mohtashims
@Neo Hi, Thank you for the reply. I...
@Neo Hi,

Thank you for the reply.

I was not sure if my approach is good / correct and hence did not share the attempts made.

I have updated my original post with the code of what I tried.
Forum: Shell Programming and Scripting 2 Weeks Ago
616
Posted By mohtashims
Sort file data according to a custom list of string
I have a string of pre defined ip address list which will always remain constant their order will never change like in below sample:

iplist=8.8.5.19,9.7.5.14,12.9.9.23,8.8.8.14,144.1.113

In the...
Forum: Shell Programming and Scripting 2 Weeks Ago
449
Posted By mohtashims
I dont find the file ssh.conf on either of the...
I dont find the file ssh.conf on either of the source servers:

[root@mymac /]# pwd
/
[root@mymac /]# find . -name ssh.conf
[root@mymac /]# find . -name ssh*.conf
find: ‘./proc/43193’: No such...
Forum: Shell Programming and Scripting 2 Weeks Ago
449
Posted By mohtashims
I do have root access but I m not a system admin....
I do have root access but I m not a system admin. I checked sshd.conf and found them to be identical on both the source systems.

Can you please give me pointers as to which file / configuration...
Forum: Shell Programming and Scripting 2 Weeks Ago
449
Posted By mohtashims
The servers were setup by a different team so I'm...
The servers were setup by a different team so I'm not sure if they were setup identical.

Here is the requested output [Left side is success | Right side is failure]:

$ diff -by...
Forum: Shell Programming and Scripting 2 Weeks Ago
449
Posted By mohtashims
ssh fails from one server only with expecting SSH2_MSG_KEXDH_REPLY message
I have two linux servers viz 12.7.44.18 and 12.7.45.18

I wish to ssh from both these server to a destination AiX server 12.7.33.18

The ssh works from 12.7.44.18 -> 12.7.33.18 but fails from...
Forum: Shell Programming and Scripting 3 Weeks Ago
682
Posted By mohtashims
I'm getting syntax error when i specify a file. ...
I'm getting syntax error when i specify a file.
awk '
/^[0-9.]+$/ {st=$0; next}; {T[st] = $0 RS T[st]}
END {for(i in T) printf "%s", i RS T[i]}
' < < (cat report1.txt)...
Forum: Shell Programming and Scripting 3 Weeks Ago
682
Posted By mohtashims
@nezabudka here is the output: For: while...
@nezabudka here is the output:

For:
while read -r fline; do
((counter++))
echo "$fline" | sed 's/\\n/\n/g'
echo $counter
done <<< "$str1"

Output:
./test2.sh ...
Forum: Shell Programming and Scripting 3 Weeks Ago
682
Posted By mohtashims
Need to format string to collate data of similar IP address.
I have a string which has IP and data of files for that ip which is printed using the below code: Sample string code below:

str1="10.9.11.128\n-rwxr-xr-x user1 2019-12-29 17:53...
Forum: Shell Programming and Scripting 3 Weeks Ago
619
Posted By mohtashims
Works :) Thank you.
Works :) Thank you.
Forum: Shell Programming and Scripting 3 Weeks Ago
619
Posted By mohtashims
Need to convert \n character to newline in UNIX.
I have a variable like below:

str1="10.9.11.128\n-rwxr-xr-x user1 2019-12-29 17:53 /var/branch/custom/tg.xml 286030210\n10.9.12.129\n-rwxr-xr-x user1 2019-12-29 17:53 /app/branch/custom/tg.xml...
Showing results 1 to 25 of 500

 

Featured Tech Videos

All times are GMT -4. The time now is 08:09 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy