Search Results

Search: Posts Made By: mohtashims
75,474
Posted By mohtashims
Unable to print last line in Linux in while loop
Below is my shell script:

printf "10\n-rwxr-xr-x 73\n-rwxr-xr-x 74\n10\n-rwxr-xr-x 75\n-rwxr-xr-x 76" |
while IFS=' '
read -r dirn
do
echo "dirn :"$dirn
done

Output:
$ ./test.sh...
65,215
Posted By mohtashims
Touch file inside directory referenced by wild card.
I'm on the AiX system.

ls -d /[Oo]racle/mymac/ returns

/oracle/mymac/ or /Oracle/mymac/ whichever is found on my system.

I wish to touch a file file.tmp inside the found directory.

I...
16,330
Posted By mohtashims
Du command takes too long to respond
I understand that my folder has huge amount of files / data.

When I fire the command du -sm * its been running past 30 minutes with NO output on my AiX system.

ls -ltr command returns output...
69,838
Posted By mohtashims
I tried #!/bin/bash /usr/bin/find...
I tried

#!/bin/bash
/usr/bin/find /app/Jenkins/home/jobs/test1/builds -type d -mtime 1 -exec rm -rf {} \;
/usr/bin/find /app/Jenkins/home/jobs/test2/builds -type d -mtime 1 -exec rm -rf {} \;...
69,838
Posted By mohtashims
Unable to execute find command from inside a shell script
I have a shell script with 775 permission as below

/app/script/test.sh

#!/bin/bash
/usr/bin/find /app/Jenkins/home/jobs/test1/builds -type d -mtime 1 | xargs rm -rf
/usr/bin/find...
14,166
Posted By mohtashims
Any other solution apart from a reboot as this is...
Any other solution apart from a reboot as this is production server?
14,166
Posted By mohtashims
We are unable to force kill pid on AIX
I have a script that creates tar file and in the next command it gzip the tar file.

While the script was running midway i happen to force delete the tar file that was still being constructed.
...
50,137
Posted By mohtashims
@Rudic with your suggestion tar -X ./exclude.txt...
@Rudic with your suggestion tar -X ./exclude.txt -cf - ./1043 | gzip -c >/backup/App_Bckup.tar.gz I still get the below error messages:

tar: ./1043/B2KCOMP/b2kcomp/15002S10485964.70600 could not...
50,137
Posted By mohtashims
Combining tar and gzip errors on AIX system.
The below tar of folder 1043 command works fine on AiX system.

tar -X ./exclude.txt -cvf /backup/App_Bckup.tar ./1043 | tee /tmp/tar.out
gzip /backup/App_Bckup.tar ./1043

I wanted to combine...
6,050
Posted By mohtashims
The problem I face is that the match pattern...
The problem I face is that the match pattern comes from a variable thus using escape charecters becomes difficult and i get the below error:

sed 's/^.*/tmp/10203/cust/01$/<font...
6,050
Posted By mohtashims
Add text before and after matched string on the same line.
I have a file with many lines. Below I'm highlighting only those line that concerns me from the file.
....
drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust/01
.......
6,890
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
...
28,109
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...
25,301
Posted By mohtashims
Thank you @MadeInGermany that answers my query.
Thank you @MadeInGermany that answers my query.
25,301
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?*'
...
25,301
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.
25,301
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:
...
26,895
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...
26,895
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...
26,895
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...
26,895
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...
20,412
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:...
15,850
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...
15,850
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...
19,043
Posted By mohtashims
Thank you as it helped resolve the problem.
Thank you as it helped resolve the problem.
Showing results 1 to 25 of 500

 
All times are GMT -4. The time now is 02:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy