Educating the world

Our blog has over 10,000 readers a month

« Changing your account name on HotmailTips and tricks for searching Google »


Comment from: Pete [Visitor]  

Hi there, I’ve tried to implement this script but get the following error…

./ line 49: ed: command not found

Can you recommend any fixes?

Many thanks in advance

02/02/10 @ 13:04
Comment from: davidnewcomb [Member]  
02/02/10 @ 13:35
Comment from: George [Visitor]

Thanks, this was just what I was looking for.

01/04/10 @ 09:35
Comment from: Anonymous [Visitor]

For some reason when trying to execute the script I am getting the following error:

./ line 60: syntax error: unexpected end of file

Any ideas?

I suspect this is related somehow in EOF marks on the file itself, as the Notepad++ seems to color the rest of the file from the first EOF line to blue.

I have tried Notepad++ as well as pico when editing, but same error occurs when trying to execute the script…

27/10/10 @ 09:20
Comment from: davidnewcomb [Member]  

The file doesn’t contain 60 lines so there must be a problem with the characters at the end of the file.

Try cut and pasting it into something like notepad. Yeh - I know, the side effect of all its faults is that it does strip away anything that is not ASCII. Then save as plain text, and you should be fine.

27/10/10 @ 14:54
Comment from: Paul [Visitor]  

i’m getting the same error: ‘line 60: syntax error: unexpected end of file’ can anyone email me a working file to try ?

04/12/10 @ 01:08
Comment from: davidnewcomb [Member]  

The trouble is that you have cut and pasted the script from this page straight into your terminal.
When you did so the editor added some indentation. In doing so it would have indented the EOF marker from the end of the “ed” script. With no marker the file terminates at the end of the file with the error.

To correct the problem move the EOF marker so that it is the only text on the line and it starts at the beginning of the line.

06/12/10 @ 10:48
Comment from: Paul [Visitor]

Thanks, don’t really understand Linux files so not sure how to fix it, could you make a file available to download? I’ve just updated to Plesk 9.53 now but still seems to be the same problem which I though should be fixed in v9

09/12/10 @ 05:00
Comment from: davidnewcomb [Member]  

Maybe I can get another blog article about using inline pipes in shell scripts.

I have uploaded the file to here:

You will see that the following “ed” line finishes with EOF:
ed nav_nooptions.html << EOF
and all the lines to the corresponding EOF marker are how they would appear in the file that would have been piped in.

09/12/10 @ 09:57
Comment from: Paul [Visitor]

Cool thanks, that work a treat, used on Plesk 9.5.3 ….. any way to format date like ‘Dec 2010′ format ???

10/12/10 @ 13:36
Comment from: Paul [Visitor]

Any chance of uploading the monthly fix as well …. I’m not sure whether the monthly stats are fixed in plesk 9 at the moments they’re are still missing in the current month view - upgraded to Plesk 9 a few days ago so maybe that won’t become apparent until January if they’ve fixed it …

10/12/10 @ 13:46
Comment from: davidnewcomb [Member]  

Formatting the dates would be handled by the awstats generation file. The program merely sorts the existing entries into order.
You’ll have to read all about awstats yourself. Besides if Plesk is messing up the ordering already and you try to sort Jan, Feb, … into alphabetical order they will be even more messed up!

As far as I know the month thing is not fixed in Plesk either but my solution still works as is.

12/12/10 @ 23:48
Comment from: Jennifer Arsenault [Visitor]  
Jennifer Arsenault

I know this is an old article, but I thought I could help someone else. Apparently, this is still an issue on Plesk 11.

I’m moving to a new server, and I’m new to Plesk. I just figured out how to migrate years of Awstats data files and was irritated by the random menu order. It’s especially an issue if there are more than a couple of months. A Google search brought me here. And your script is just what I needed.

However, I too would like to have text months rather than numbers, so I set out to tweak your script. Although I do have a programming background, this is my first attempt at shell programming. There’s probably a better way to do this, but here is what I came up with.

Add the following line near the top where the other variables are set. Use full months instead of abbreviated ones if you prefer.
MONTHS=(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)

Add the following 4 lines at line 48.
for MONTH in 1 2 3 4 5 6 7 8 9 10 11 12
sed -i “s/-`printf ‘%.2d’ $MONTH`</ ${MONTHS[MONTH-1]}</g” nav_options.html

The above changes only the display months and not the values so it doesn’t affect function at all. I haven’t tested the original or edited script via cron yet, but it works from the command line.

Hope it helps someone else.

17/10/12 @ 21:52

Leave a comment

Your email address will not be revealed on this site.

Your URL will be displayed.
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)