Search Results

Search: Posts Made By: mutley2202
5,569
Posted By RudiC
You need to use "command substitution" (c.f. man...
You need to use "command substitution" (c.f. man bash). Try
final=$( echo "scale=4; ($sum1 / $sum2 ) * 100" | bc) or, if you have a recent shell, a "here string"
bc <<< "scale=4; ($sum1 / $sum2 )...
6,315
Posted By RudiC
Or, reading input just once: awk -F, '{++C[$1];...
Or, reading input just once:
awk -F, '{++C[$1]; T[$1] = $0} END {for (t in T) if (C[t] == 1) print T[t]}' file
877,RIBDF,E28
6,315
Posted By RavinderSingh13
Hello mutley2202, Could you please try...
Hello mutley2202,

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

awk -F, 'FNR==NR{++A[$1];next} ($1 in A) && A[$1] == 1{print}' Input_file Input_file
OR(more precisely) ...
1,024
Posted By RavinderSingh13
Hello mutley2202, Could you please try...
Hello mutley2202,

Could you please try following and let me know if this helps you. Let's say following is Input_file.

cat Input_file
12
123 FP
11
10 RFP

Then i is a variable whose...
3,198
Posted By Scrutinizer
Try: awk -F. '{printf...
Try:
awk -F. '{printf "%03d.%03d.%03d.%03d\n",$1,$2,$3,$4}' file
or
awk '{for(i=1; i<=NF; i++) $i=sprintf("%03d",$i)}1' FS=. OFS=. file
2,313
Posted By Aia
Isolate the number pattern and place it inside...
Isolate the number pattern and place it inside the capturing group in red.
$ cat test.file
ses:3317] start call ms <0781234567> id < 13102 > id2 <0a23> index 858
ses:3318] start call ms...
2,313
Posted By RudiC
If we are dealing only with 10 digit numbers lead...
If we are dealing only with 10 digit numbers lead by "078", that will work. If not, we need to know more to identify the digits to be replaced, like "the first angle bracketed number in the resp....
2,313
Posted By Don Cragun
For the sample output you showed us (with the...
For the sample output you showed us (with the output being 10 "x"s surrounded by angle brackets), the following should work with any version of sed that conforms to the standards:
sed...
6,943
Posted By Corona688
You could open both at once, perhaps, using...
You could open both at once, perhaps, using open() instead of backticks. How about this:

open(CMD1, "./ssh_run_cmd2.exp xxx.xxx.xxx.xxx $log "show association peer-address $ip", "-|");
...
1,135
Posted By MadeInGermany
join file1 file2for more options see man join--...
join file1 file2for more options see
man join--
join -t " " file1 file2seems to preserve the format. NB the key in field#1 is not repeated.
1,411
Posted By RudiC
awk reads and processes every single line in the...
awk reads and processes every single line in the input stream. A line starting with NE : is stored in the variable P, overwriting the last one, then that line's processing is abandoned and the next...
1,411
Posted By Scrutinizer
The suggestions works if there is always one line...
The suggestions works if there is always one line without NE :. If there are more lines then P gets printed for every following line, so a provision would need to be made if that could be the case.....
1,411
Posted By RudiC
Like so? awk '/^NE :/ {P=$0; next} {print P}'...
Like so?
awk '/^NE :/ {P=$0; next} {print P}' file
NE : V0004
NE : V00005
1,910
Posted By Don Cragun
Please show us what you have. There are hundreds...
Please show us what you have. There are hundreds of ways to do this, but to understand what you're doing and how to give you a working solution for your problem it would help a lot to see what...
1,884
Posted By jim mcnamara
You cannot easily 'enter a password' with ssh, it...
You cannot easily 'enter a password' with ssh, it is built to bypass most attempts at that.
The passwd command is also that way. You will need to bypass those problems which involves some advanced...
Showing results 1 to 15 of 15

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