Unix/Linux Go Back    

Showing results 1 to 25 of 500
Search took 0.12 seconds.
Search: Posts Made By: Scrutinizer
Forum: Homework & Coursework Questions Linux 5 Days Ago
Replies: 9
Views: 204
Posted By Scrutinizer
Consider the difference between || and &&

Consider the difference between || and &&
Forum: Homework & Coursework Questions Linux 5 Days Ago
Replies: 9
Views: 204
Posted By Scrutinizer
Hi, You are using a loop that is never...

Hi,

You are using a loop that is never exited, no matter what the input.
Also, there is a difference between a string comparison and a numerical comparison.
A case statement can only match...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 5
Views: 112
Posted By Scrutinizer
To do it in shell it is best to turn off field...

To do it in shell it is best to turn off field splitting (that also removes leading and trailing whitespace) and other interpretations by the shell:

switch off splitting IFS (IFS=)
ignore \...
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 5
Views: 112
Posted By Scrutinizer
Or can it be paste? paste - - < file ...

Or can it be paste?
paste - - < file



--
Note: \t in the replacement part of the "s" command is GNU sed only. For regular sed use actual TAB characters (CTRL-V TAB).
Forum: Shell Programming and Scripting Linux 1 Week Ago
Replies: 3
Views: 91
Posted By Scrutinizer
Hi, try: awk ' { n=split($6,F,/,/) ...

Hi, try:
awk '
{
n=split($6,F,/,/)
split($7,G,/,/)
split($8,H,/,/)
$6=$7=$8=""
for(i=1; i<=n; i++) {
s=(i>1)?",":""
$6=$6 s F[i] ":" G[i]
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 3
Views: 129
Posted By Scrutinizer
Like RudiC mentioned, x=$1 Assigns the value of...

Like RudiC mentioned, x=$1 Assigns the value of the first parameter with which the script is called to variable x
After this there are 5 iterations that add a number to variable x
So in the end...
Forum: UNIX for Beginners Questions & Answers Linux 1 Week Ago
Replies: 5
Views: 257
Posted By Scrutinizer
On these lines before you did not escape the...

On these lines before you did not escape the double quotes (\") for font size.
Also this line is never used (and rightly so in this case): echo "/usr/sbin/sendmail -fsocket $SupportId << END" >...
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 5
Views: 102
Posted By Scrutinizer
For sort to work you also have to specify the...

For sort to work you also have to specify the field separator. You can try:
sort -ut\; -k1,1 fileHowever, this is not standard (POSIX) behavior for sort and cannot be relied upon and some sorts will...
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 5
Views: 102
Posted By Scrutinizer
What have you tried @arunkumar_mca?

What have you tried @arunkumar_mca?
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 5
Views: 117
Posted By Scrutinizer
Try:awk '{$12=sprintf("%03d",$12)}1' FS=\; OFS=\;...

Try:awk '{$12=sprintf("%03d",$12)}1' FS=\; OFS=\; file
orawk -F\; -v OFS=\; '{$12=sprintf("%03d",$12)}1' file
orawk 'BEGIN{FS=OFS=";"} {$12=sprintf("%03d",$12)}1' file
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 3
Views: 137
Posted By Scrutinizer
At any rate you need a wait statement after done...

At any rate you need a wait statement after done in the first script..
Also, no pipe is being created and removed in these scripts.
This code would create a file called "nvpipe", rather than a...
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 1
Views: 117
Posted By Scrutinizer
A return statement is used to exit a function. I...

A return statement is used to exit a function. I think you are looking for the exit statement ?
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 1
Views: 106
Posted By Scrutinizer
Hi, try: awk 'NR==FNR{C[$6]++; next} $1 in...

Hi, try:
awk 'NR==FNR{C[$6]++; next} $1 in C{print $1, C[$1]}' FS=\; file2 FS=" " file1
Forum: UNIX for Beginners Questions & Answers Linux 2 Weeks Ago
Replies: 2
Views: 107
Posted By Scrutinizer
For starters: use if, not 'If'. You need...

For starters:

use if, not 'If'.
You need a space after the [[
There is no done statement
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
You're welcome. That the slack channel prints...

You're welcome. That the slack channel prints ugly may have to do with the use of proportional vs. monospace fonts (hint: You get the monospace font by using "code tags...
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
You are correct. It should be the other way...

You are correct. It should be the other way around according to specification. However some awks (mine) seem to be tolerant to the switcheroo! Corrected in my posts.
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
@RudiC: Yes that is what posts #6 and #8 take...

@RudiC: Yes that is what posts #6 and #8 take into account.
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
You're welcome. Since it appears to work with the...

You're welcome. Since it appears to work with the sample header row:
How does your real life header row differ from your sample header row.
Forum: Shell Programming and Scripting Linux 2 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
Well then try enlarging the first column to 40: ...

Well then try enlarging the first column to 40:
awk -F'\t *' '{printf "%40-s%16-s%20-s%26-s%16-s%8-s%10-s%14-s%10-s%10-s%-s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11} NR==1{FS=","}' file
--edit--
As...
Forum: Shell Programming and Scripting Linux 3 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
Try: awk -F'\t *' '{printf...

Try:
awk -F'\t *' '{printf "%25-s%16-s%20-s%26-s%16-s%8-s%10-s%14-s%10-s%10-s%-s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11} NR==1{FS=","}' file
Note: the - sign should be behind the procent sign in the...
Forum: Shell Programming and Scripting Linux 3 Weeks Ago
Replies: 4
Views: 183
Posted By Scrutinizer
I would just use a scheduler to do that. For...

I would just use a scheduler to do that. For example cron understands weekdays. The you do not need to check the date inside the script. You can have two command line options for full and incremental...
Forum: Shell Programming and Scripting Linux 3 Weeks Ago
Replies: 16
Views: 354
Posted By Scrutinizer
If you want to properly format the output, then I...

If you want to properly format the output, then I suggest you use printf statement.
For example:
awk -F, '{printf "%13-s %10-s %9-s %18-s %14-s %5-s %7-s %8-s %10-s %9-s...
Forum: Shell Programming and Scripting Linux 3 Weeks Ago
Replies: 5
Views: 252
Posted By Scrutinizer
To put a fine point on it: Every modern shell has...

To put a fine point on it: Every modern shell has [/test as a shell builtin (utility) and since it is still a utility, variables are expanded and field splitted so that they can be passed as fields...
Forum: UNIX for Beginners Questions & Answers Linux 3 Weeks Ago
Replies: 3
Views: 173
Posted By Scrutinizer
But this is puzzling: END {gzip file} It does...

But this is puzzling:
END {gzip file}
It does not do anything
Forum: UNIX for Beginners Questions & Answers Linux 3 Weeks Ago
Replies: 4
Views: 213
Posted By Scrutinizer
Instead of: ps aux | grep xx try: ps aux |...

Instead of:
ps aux | grep xx
try:
ps aux | grep '[x]x'
To ensure the grep process itself isn't one of the processes being matched.
Showing results 1 to 25 of 500

 


All times are GMT -4. The time now is 01:20 PM.