Search Results

Search: Posts Made By: RavinderSingh13
128
Posted By RavinderSingh13
Hello jvoot, Could you please try following....
Hello jvoot,

Could you please try following.

awk 'FNR==NR{a[$1]=$2;next} ($0 in a){print $1,a[$1]}' Input_file2 Input_file1


Output will be as follows.

ABC 123
DEF 345
XYZ 678
ABC...
1,662
Posted By RavinderSingh13
Hello jcdole, Yes, that could be shorten to...
Hello jcdole,

Yes, that could be shorten to following.

MY_PATTERN="="
SOME_VAR=$(awk -F"$MY_PATTERN" '{split($1,array," ");print array[3]}' Input_file)
echo "$SOME_VAR"


Thanks,
R. Singh
531
Posted By RavinderSingh13
Hello jiam912, We encourage users to add...
Hello jiam912,

We encourage users to add their efforts which they have put in order to solve their own problems in their post.
So kindly do let us know what you have tried to solve this?
...
676
Posted By RavinderSingh13
Hello sand1234, Following is the complete...
Hello sand1234,

Following is the complete explanation on same.

awk ' ##Starting awk command here.
{
ORS=length==80?"":RS ##Setting ORS by checking condition if...
676
Posted By RavinderSingh13
Hello sand1234, Here is the explanation of...
Hello sand1234,

Here is the explanation of it:

As you could see there are 2 %s written in printf which are connected to following.

%s -----> length($0)==80?ORS:""
%s -----> $0

1st one...
676
Posted By RavinderSingh13
Hello sand1234, Could you please try...
Hello sand1234,

Could you please try following(not tested though).

awk '{printf("%s%s",length($0)==80?ORS:"",$0)} END {print ""}' unwrap2.txt


Thanks,
R. Singh
676
Posted By RavinderSingh13
Hello sand1234, Could you please try...
Hello sand1234,

Could you please try following.


awk '{printf("%s%s",$0~/^[0-9]+/ && FNR>1?ORS:FNR==1?"":OFS,$0)}' Input_file


Output will be as follows.


2019 Sep 28 10:47:24.695...
676
Posted By RavinderSingh13
Hello sand1234, When I ran code for your...
Hello sand1234,

When I ran code for your samples it worked fine for me, if still it is giving no new line at last edit it like:

awk '{printf("%s%s",$0~/^[0-9]+/ &&...
Forum: What is on Your Mind? 10-12-2019
1,148
Posted By RavinderSingh13
For me Dark Green color looks great :cool: :b: ...
For me Dark Green color looks great :cool: :b:
Thanks Neo for doing this.

Thanks,
R. Singh
632
Posted By RavinderSingh13
Hello akopocpoypoy, Could you please try...
Hello akopocpoypoy,

Could you please try following.

awk '
{
while(match($0,/Oct [0-9]+/)){
val=sprintf("%s %02d",substr($0,RSTART,4),substr($0,RSTART+3,RLENGTH-3))
sub(/Oct...
Forum: Programming 09-15-2019
338
Posted By RavinderSingh13
Regarding a GREAT site for understanding and Visualizing regex patterns.
Hello All,

While googling on regex I came across a site named Regulex Regulex´╝ÜJavaScript Regular Expression Visualizer (https://jex.im/regulex/#!flags=&re=%5E(a%7Cb%7Cc)(%5B%5E%40%5D*)%40(.*))
I...
Forum: What is on Your Mind? 09-06-2019
2,175
Posted By RavinderSingh13
Thanks a TON Neo for doing so :b: Welcome...
Thanks a TON Neo for doing so :b:

Welcome Yoda(one of my inspirations in scripting) to the MODs group :b:

Thanks,
R. Singh
990
Posted By RavinderSingh13
Hello mrcool4, On unix.com we encourage...
Hello mrcool4,

On unix.com we encourage users to post their efforts in their question which they have put in order to solve their own problems.
So kindly do so and let us know then.

Thanks,...
Forum: What is on Your Mind? 09-03-2019
2,175
Posted By RavinderSingh13
Thanks Neo for doing so :b: Welcome to MODs...
Thanks Neo for doing so :b:

Welcome to MODs group Akshay :b:

Thanks,
R. Singh
Forum: What is on Your Mind? 08-18-2019
2,912
Posted By RavinderSingh13
Thanks a TON Neo for doing this :b: Welcome...
Thanks a TON Neo for doing this :b:

Welcome to MODs group Peasant, you ROCK :b:

Thanks,
R. Singh
850
Posted By RavinderSingh13
Hello harveyclayton, Please post samples of...
Hello harveyclayton,

Please post samples of input and expected output along with what you have tried to solve your own problem.

Thanks,
R. Singh
3,407
Posted By RavinderSingh13
Hello cokedude, Could you please try...
Hello cokedude,

Could you please try following(I haven't tested it though).


awk '/dev/ && $5+0 > 70' Input_file


Thanks,
R. Singh
341
Posted By RavinderSingh13
Hello Adarshreddy01, IMHO that's because you...
Hello Adarshreddy01,

IMHO that's because you are passing output of cat file1 command to while loop which is considered as a new shell(or in other language creates a sub shell to execute while...
1,380
Posted By RavinderSingh13
Hello Vinod, When you see man page for ps...
Hello Vinod,

When you see man page for ps you see like.



So Rudi's code is actually comparing if a process is older then 7200 seconds which is 2 hours and if condition is TRUE it prints it...
1,146
Posted By RavinderSingh13
Hello arunkumar_mca, Could you please try...
Hello arunkumar_mca,

Could you please try following once.


awk '{val1=substr($0,9,6);val2=val1+0<10000?sprintf("%06d",val1*1000):val1;print substr($0,1,8) val2 substr($0,15)}' Input_file

...
1,360
Posted By RavinderSingh13
Hello Raghuram717, Could you please try...
Hello Raghuram717,

Could you please try following(haven't tested it though).


awk '/^sdg-catalog/{close(file);file=$0;next} {print > file}' Input_file


Thanks,
R. Singh
1,692
Posted By RavinderSingh13
Hello DevAakash, Could you please try...
Hello DevAakash,

Could you please try following.

awk 'FNR==NR{for(i=1;i<=NF;i++){a[i]=$i};next} {print a[FNR],$2}' FS="," Input_file2 FS=":" OFS=":" Input_file1


Thanks,
R. Singh
Forum: Cybersecurity 05-17-2019
798
Posted By RavinderSingh13
**ALERT**ALERT* Whats app requesting users to upgrade to latest version as; its vulnerability found.
Hello All,

Want to share here an article for Whats app users that team whats app is requesting users to upgrade to its latest version since they have found a vulnerability; where Hacker could turn...
147
Posted By RavinderSingh13
Hello cmccabe, Could you please try...
Hello cmccabe,

Could you please try following.

awk -F, '/VPS/{num=split($4,array,"[ -]");if(num==3){print array[1],array[2]+1,array[3],$1};if(num==2){print array[1],array[2]-1,array[2],$1}}' ...
190
Posted By RavinderSingh13
Hello baris35, Very good that you have...
Hello baris35,

Very good that you have solved your question by yourself and appreciate that you have shared with us too, keep it up :b:
You could better your solution by doing this:

awk...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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