Search Results

Search: Posts Made By: Junaid Subhani
3,109
Posted By RudiC
man pgrep:
man pgrep:
990
Posted By Aia
You can pick whatever you would like to use. I...
You can pick whatever you would like to use. I just shown you a more efficient way of extracting the fields you want.
990
Posted By Aia
Run as ./script.sh /tmp/test or perhaps...
Run as ./script.sh /tmp/test or perhaps ./script.sh if you are in /tmp/test and scritp.sh lives there.


#!/bin/bash

path_base="${@:-.}"
for f in "${path_base}"/*war.*; do
name="${f##*/}"...
131,542
Posted By alister
I would suggest caution with this idiom. In...
I would suggest caution with this idiom.

In this specific case, where a single row/line of output is desired, if the actual data is large enough, it's possible that echo could be invoked more than...
1,136
Posted By drl
Hi. To what granularity? Same year? Same...
Hi.

To what granularity? Same year? Same month? Day? Hour?, etc.

Best wishes ... cheers, drl
1,753
Posted By Aia
Please, try either of: perl -nle...
Please, try either of:

perl -nle 'while(/(\d{11}\|\d{4}-\d{2}-\d{2} \d+:\d+:\d+.\d)\s/g){print $1}' longstring.input

perl -nle 'while(/(.*?\s.*?)\s/g){print $1}' longstring.input
1,753
Posted By RavinderSingh13
Hello Junaid Subhani, Could you please try...
Hello Junaid Subhani,

Could you please try following and let me know if this helps.

xargs -n2 < Input_file
Output will be as follows.

65450524121|2015-11-20 20:17:59.0...
1,324
Posted By Scrutinizer
Try (untested) something like: { time wget...
Try (untested) something like:
{ time wget https://`ifconfig -a | grep '32.29.120' | cut -d: -f2 | cut -d' ' -f1`:8443/primary-rest/shop?brandId=test --header="name: test" --no-check-certificate -o...
1,713
Posted By Scrutinizer
Hi, the biggest problem is with the slashes that...
Hi, the biggest problem is with the slashes that are part of the variables. Try using | as a delimiter instead..:

sed "\|${CAC_ENDPOINT}|s|.*|${NEW_ENDPOINT}|"
1,713
Posted By Aia
${NEW_ENDPOINT} has / inserted in it and when it...
${NEW_ENDPOINT} has / inserted in it and when it gets expanded sed sees
s/eai.endpoint.url=*/eai.endpoint.url=http://www.endpoint.com/API/g
The slashes in the URI gets confused with the delimiters....
1,713
Posted By bakunin
As it is your regex means something different:...
As it is your regex means something different: First, "." means "any single character", and "*" means "the preceding expression or single character is optional". Your regex therefore means:

"eai",...
981
Posted By Aia
Try the silent flag: -s/--silent Silent...
Try the silent flag:
-s/--silent
Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute.
1,159
Posted By Aia
echo "(http-/0.0.0.0:8091-9)|23:00:41" | perl...
echo "(http-/0.0.0.0:8091-9)|23:00:41" | perl -nle '/\((.+)\)\|\d/ and print $1'

I suspect that you can do much better if you extract the value clean from the first pass when you use awk to get...
1,159
Posted By Don Cragun
It would seem that the awk command: awk...
It would seem that the awk command:
awk -F'[()]' '{print $2}' file
does exactly what you want.

If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
1,289
Posted By RudiC
Group your commands in parentheses or braces, and...
Group your commands in parentheses or braces, and tee or redirect that group's output.
1,289
Posted By RudiC
Did you consider the tee command?
Did you consider the tee command?
2,590
Posted By Corona688
Ahh, that's a multi-line string, isn't it. ...
Ahh, that's a multi-line string, isn't it.

In what way does it not work? Does it find no changes, or always find changes?
2,590
Posted By RudiC
Are you sure the quoting in the second diff is...
Are you sure the quoting in the second diff is correct?
2,590
Posted By Aia
diff '--changed-group-format=%>'...
diff '--changed-group-format=%>' --unchanged-group-format='' $TMP_FILE $TMP > $TMP
That's the same location. Change the location where the output is redirected.
3,351
Posted By Don Cragun
For the same reasons that dozens of other threads...
For the same reasons that dozens of other threads have asked about...
The environment used by cron (and passed to programs it runs), is not you login shell's environment.

You either need to have...
3,351
Posted By hicksd8
There doesn't appear to be anything wrong with...
There doesn't appear to be anything wrong with the script. As Don said (post#2), nearly all these things are because the interactive login and cron environments are different; perhaps the variables...
3,351
Posted By MadeInGermany
Ravinder, the diff is okay; the redirection of...
Ravinder, the diff is okay; the redirection of stdout does not clear the exit status.
In fact your correction is faulty:
2&>1 should be 2>&1 (redirect stderr to descriptor 1, and should be appended...
1,332
Posted By Corona688
If you sort the files before comparing, they will...
If you sort the files before comparing, they will be in the same order and therefore identical.
1,332
Posted By Don Cragun
No. Sorting a file will not turn a single line...
No. Sorting a file will not turn a single line in one file into seven lines in another file.

And, neither cat nor grep will split or combine lines. So..., the format of Junaid Subhani's two...
1,005
Posted By neutronscott
That's a terrible way to handle data. You can use...
That's a terrible way to handle data. You can use a while read loop and handle this much better. I assume you're passing an argument to the script to match on column 2.


#!/bin/bash

while read...
Showing results 1 to 25 of 48

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