Search Results

Search: Posts Made By: mohtashims
117
Posted By mohtashims
Remove lines containing strings from a file
Experts Hi,

I wish to remove lines containing the following strings from a file hello.out and save it in new_hello.out file.

1. text4
2. text5
3. text11
4. file13
5. file15
6. text16
...
238
Posted By mohtashims
Array declared in shell script works for AIX but fails in Linux
Array declared in shell script works for AiX 6.1 and above but fails in Linux CentOS 7.

I have the below code for Array in my shell script that runs fine on AiX systems.

Note: on AiX it uses...
324
Posted By mohtashims
Thank you @MadeInGermany that answers my query.
Thank you @MadeInGermany that answers my query.
324
Posted By mohtashims
@MadeInGermany i tried the ?* but the problem is...
@MadeInGermany i tried the ?* but the problem is i get .jsp files in the output because of '*.js?*' when a .jsp should not be returned in the output when i have -o -name '*.js?*'
...
324
Posted By mohtashims
@Neo Hi, Thank you for your inputs. I have...
@Neo Hi, Thank you for your inputs. I have updated the Original Post with the output.
324
Posted By mohtashims
Unable to find files using wildcard on AIX.
I wish to seach for files extensions .xml, .jsp followed by <whatever> charecters under directory custom while excluding folders "BACKUP" & "TMP"

Thus for a sample set like below:
...
677
Posted By mohtashims
@Rudic thank you for the input and it is...
@Rudic thank you for the input and it is certainly returning a single row however not the intended row.

If you look at the output when i pass 4 to get the 4th row it returns the 3rd row as the...
677
Posted By mohtashims
@Rudic sorry that was by overlook. With parameter...
@Rudic sorry that was by overlook. With parameter 3 the row returned should be the third row ie.
-rwxrwxrwx 1 user1 user 21624 Feb 11 17:13 httpd.conf_1581421456

Likewise when the user passes 4...
677
Posted By mohtashims
If the user passes 1 then i need the newest...
If the user passes 1 then i need the newest latest file.

If the user passes 2 then i wish to display only the newest - 1 file i.e second latest file.

if the user passes 3 then the third latest...
677
Posted By mohtashims
How do we display specific row of an output from bottom given line number?
I pass a number to my script. Passing "1" below.

./getfile.sh 1
echo "User entered: $1"
ls -ltr *.conf | sed -n '$p'
I wish to use ls -ltr i.e list files in ascending order of time the latest...
Forum: Shell Programming and Scripting 3 Weeks Ago
560
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:...
Forum: Shell Programming and Scripting 4 Weeks Ago
722
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...
Forum: Shell Programming and Scripting 4 Weeks Ago
722
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...
Forum: Shell Programming and Scripting 4 Weeks Ago
799
Posted By mohtashims
Thank you as it helped resolve the problem.
Thank you as it helped resolve the problem.
Forum: Shell Programming and Scripting 4 Weeks Ago
653
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...
799
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
...
799
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.
799
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:
...
1,140
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...
1,140
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...
1,140
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.

$...
1,140
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"...
1,140
Posted By mohtashims
I will check on this tomorrow and update if it...
I will check on this tomorrow and update if it works
1,140
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.
1,140
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.
Showing results 1 to 25 of 500

 

Featured Tech Videos

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