Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: Sumanthsv
6,792
Posted By RudiC
As ususal: what OS and shell versions? In...
As ususal: what OS and shell versions?


In (recent) bash, set the pipefail option:
$ set -o pipefail
$ ls -l fxxxx | tee -a file2 | tee file1
ls: cannot access 'fxxxx': No such file or...
797
Posted By Peasant
Try using the int builtin nawk -F "."...
Try using the int builtin

nawk -F "." '{if(int($NF)<01903) print $0}'


Hope that helps
Regards
Peasant.
5,604
Posted By Scrutinizer
Note: echo -n is not part of the standard and...
Note:
echo -n is not part of the standard and echo -n is not implemented in a standardized way.

For reliable, portable results use printf instead:
printf "%s " "$var"




--
See:
echo...
1,307
Posted By RudiC
Did you consider bash's other debug...
Did you consider bash's other debug functionalities, like shopt -s extdebug, or trap ... DEBUG?

awk doesn't have a feature similar to sed -i. Print to a temp file, and then overwrite the original.
506
Posted By Don Cragun
I believe the default shell on a Solaris 11...
I believe the default shell on a Solaris 11 system is a Korn shell, so the following should work as long as you are NOT using a csh derivative. It will certainly work with /usr/xpg4/bin/sh:...
558
Posted By RavinderSingh13
Hello Sumanthsv, Could you please go through...
Hello Sumanthsv,

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

awk '{
for(i=1;i<=NF;i++){ ##### Starting a for loop here which will start from...
558
Posted By RavinderSingh13
Hello Sumanthsv, Could you please try...
Hello Sumanthsv,

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

awk '{for(i=1;i<=NF;i++){if($i ~ /.py/){printf("%s ",$i)}};print ""}' Input_file
Thanks,
R. Singh
799
Posted By RudiC
You are searching for an owner of literally...
You are searching for an owner of literally 'username' which none of your files has, so an empty output is fine. Change the owner to be searched for to 'root' as RavinderSingh13 proposed and it...
799
Posted By RavinderSingh13
Hello Sumanthsv, Not sure if you changed...
Hello Sumanthsv,

Not sure if you changed username to root as follows while running the code.

ssh loginname@hostname ls -l | awk -v s1="root" '{if ( $3 == s1 ) print $9}'

Please...
2,371
Posted By Don Cragun
Here are two other ways to do what you seem to...
Here are two other ways to do what you seem to want; one with sed and one just using shell built-ins. (Note that in this suggested code the string assigned to var starts with a <tab> followed by a...
2,371
Posted By RavinderSingh13
Hello Sumanthsv, Following may help you in...
Hello Sumanthsv,

Following may help you in same.

awk -F, '{for(i=1;i<=NF;i++){OFS=i%2==0?",":"|";Q=Q?Q OFS $i:$i};print Q;Q=""}' Input_file
Output will be as follows.
...
2,371
Posted By RudiC
How about echo $var| sed 's/,\([^,]*\),/,\1|/g' ...
How about echo $var| sed 's/,\([^,]*\),/,\1|/g'
Name1,Value1|Name2,Value2|Name3,Value3|Name4,Value
Showing results 1 to 12 of 12

 

Featured Tech Videos

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