Search Results

Search: Posts Made By: RavinderSingh13
193
Posted By RavinderSingh13
Hello tomato00, Could you please try...
Hello tomato00,

Could you please try following.


cat script.ksh
declare -a arr=("test" "Monday" "Tuesday" "Wednesday" "Thurday" "Friday" "Saturday" "Sunday")

while read first second...
193
Posted By RavinderSingh13
Hello tomato00, On UNIX.com we encourage...
Hello tomato00,

On UNIX.com we encourage users to add their efforts whatever they have put in order to solve their own problems.
So kindly do let us know your efforts.

Thanks,
R. Singh
322
Posted By RavinderSingh13
Thank you S. So you mean sort command's stable...
Thank you S. So you mean sort command's stable utility is not supported by all O.S systems. Sorry I only run it on a online terminal which has a GNU sort, not sure about any other O.S systems,if any...
322
Posted By RavinderSingh13
Hello kshitij, Could you please try...
Hello kshitij,

Could you please try following. Written and tested with GNU awk and GNU sort.


awk '
/^[0-9]+/{
val=$NF
}
{
print val "@" $0
}' Input_file |
sort -t'@' -nrsk1,1 |...
323
Posted By RavinderSingh13
Hello kshitij, Adding a detailed level...
Hello kshitij,

Adding a detailed level explanation for my code.


awk ' ##Starting awk program from here.
FNR==NR{ ##Checking condition...
323
Posted By RavinderSingh13
Hello kshitij, Could you please try...
Hello kshitij,

Could you please try following.


awk '
FNR==NR{
if($0~/^[0-9]+/){
++count
}
sum[count]+=$NF
next
}
/^[0-9]+/{
print $0,sum[++var]
next
}
1
' ...
363
Posted By RavinderSingh13
Hello green_k, Could you please try...
Hello green_k,

Could you please try following.


awk '
/^\[/{
if(count){
for(i=1;i<=count;i++){
print val,a[i],count
}
}
val=$0
count=""
next
}
{
...
Forum: Programming 1 Week Ago
334
Posted By RavinderSingh13
Hello ramkrix, In Unix.com forums we...
Hello ramkrix,

In Unix.com forums we encourage users to add their own efforts which they have put in order to solve their own problems. So kindly do add the same and let us know then. Also samples...
363
Posted By RavinderSingh13
Hello green_k, Could you please try...
Hello green_k,

Could you please try following.


awk '/^\[/{val=$0;next} {print val,$0}' Input_file


On Sun o.s use nawk in place of awk.

Thanks,
R. Singh
363
Posted By RavinderSingh13
Hello green_k, On forums, we do encourage...
Hello green_k,

On forums, we do encourage users to add their efforts which they have put in order to solve their own problems in their questions. So kindly do so and let us know, since we all are...
315
Posted By RavinderSingh13
Hello nans, On forums we encourage users to...
Hello nans,

On forums we encourage users to do add their efforts which they have out in order to solve their own problems.
So kindly do add your efforts in your question and let us know then.
...
402
Posted By RavinderSingh13
Hello mcesmcsc, Good that you have shown us...
Hello mcesmcsc,

Good that you have shown us what you have tried to solve your own problem, keep it up.
Could you please do let us know sample of Input_file and expected output in CODE TAGS too it...
508
Posted By RavinderSingh13
Hello Sennenmut, Good that you were able to...
Hello Sennenmut,

Good that you were able to solve the problem by your own. But after working on few posts in this thread and suddenly declaring that you have solved the problem will not help...
456
Posted By RavinderSingh13
Hello arsalane, Good that you have solved...
Hello arsalane,

Good that you have solved the problem. I would like to request you to please do add that fix in this thread too, do that all users who are referring this thread in future could be...
465
Posted By RavinderSingh13
Hello veereshshenoy, Welcome to Forums :b:,...
Hello veereshshenoy,

Welcome to Forums :b:, on Unix.com we encourage all users to post 3 important things in their post.

1- Sample of Input_file in CODE TAGS.
2- Sample of expected output in...
Forum: What is on Your Mind? 2 Weeks Ago
614
Posted By RavinderSingh13
Thanks a TON Neo for inviting one of the BEST...
Thanks a TON Neo for inviting one of the BEST resources on UNIX.com appreciate that.

Welcome to MODs group Simon, I am a great fan of you coding style, cheers.

Thanks,
R. Singh
956
Posted By RavinderSingh13
Hello reldb, Could you please try following....
Hello reldb,

Could you please try following.


awk '
FILENAME=="file1.txt"{
name[FNR]=$0
next
}
FILENAME=="city.txt"{
city[++count]=$0
next
}
{
val=$0
...
714
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...
Forum: What is on Your Mind? 10-30-2019
1,357
Posted By RavinderSingh13
Thanks a TON Neo for inviting Dave in MODs team...
Thanks a TON Neo for inviting Dave in MODs team :b:

A warm Welcome Dave in MODs group :b: :b:

Thanks,
R. Singh
Forum: What is on Your Mind? 10-30-2019
1,228
Posted By RavinderSingh13
Thanks a TON Neo for informing us on same. I am...
Thanks a TON Neo for informing us on same. I am able to access site without any issues and hope all others would also be. Cheers for UNIX.com :b:

Thanks,
R. Singh
612
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?
...
767
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...
767
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...
767
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
767
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]+/ &&...
Showing results 1 to 25 of 500

 

Featured Tech Videos

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