LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-12-2005, 12:23 PM   #1
nistelrooy
Member
 
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162

Rep: Reputation: 30
Rename/VI/Awstats Reports Usage


Hi

I was generating awstats report just a moment ago. To my surprise, after the static htmls were out, some of them came out with a "?" or "^M" behind the filenames.

How can i use VI/Rename to remove the "?" or "^M" at one instant?


Below is a excerpt of what is happening,
Code:
root@xserve:/var/www/logs$ ls
awstats052005.domainz.txt           awstats.domainz.lasthosts.html?
awstats062005.domainz.txt           awstats.domainz.lastlogins.html?
awstats072005.domainz.txt           awstats.domainz.lastrobots.html?
awstats.domainz.alldomains.html     awstats.domainz.osdetail.html
awstats.domainz.allhosts.html       awstats.domainz.refererpages.html
awstats.domainz.alllogins.html?     awstats.domainz.refererse.html
awstats.domainz.allrobots.html?     awstats.domainz.unknownbrowser.html
awstats.domainz.browserdetail.html  awstats.domainz.unknownip.html?
awstats.domainz.errors404.html      awstats.domainz.unknownos.html
awstats.domainz.html                awstats.domainz.urldetail.html?
awstats.domainz.keyphrases.html     awstats.domainz.urlentry.html?
awstats.domainz.keywords.html       awstats.domainz.urlexit.html?
root@xserve:/var/www/logs$
Thanks!
 
Old 07-12-2005, 03:19 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
try
fromdos < file > newfile
or
dos2unix < file > newfile
or
sed -i "s/^M/\n/g" file


Cheers,
Tink
 
Old 07-13-2005, 10:45 AM   #3
nistelrooy
Member
 
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162

Original Poster
Rep: Reputation: 30
i cant seem to get the "sed" command working.
the ^M is still around, looks like 'a' (one) special character rather than a "^" and "M".


 
Old 07-13-2005, 01:35 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Was the wrong snippet, anyway. Sorry for that.
Try this one
sed -i -e 's/\r//g' file
 
Old 07-15-2005, 11:52 AM   #5
nistelrooy
Member
 
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162

Original Poster
Rep: Reputation: 30
Hi Tinker

it doesnt seem like the command is working..
could you help me look at it?
Code:
xserve:/usr/lib/cgi-bin/test# sed -i -e 's/\r//g' awstats.domainz.alldomains.html^M
xserve:/usr/lib/cgi-bin/test# ls
awstats.domainz.alldomains.html?     awstats.domainz.keyphrases.html?    awstats.domainz.refererse.html?
awstats.domainz.allhosts.html?       awstats.domainz.keywords.html?      awstats.domainz.unknownbrowser.html?
awstats.domainz.alllogins.html?      awstats.domainz.lasthosts.html?     awstats.domainz.unknownip.html?
awstats.domainz.allrobots.html?      awstats.domainz.lastlogins.html?    awstats.domainz.unknownos.html?
awstats.domainz.browserdetail.html?  awstats.domainz.lastrobots.html?    awstats.domainz.urldetail.html?
awstats.domainz.errors404.html       awstats.domainz.osdetail.html?      awstats.domainz.urlentry.html?
awstats.domainz.html?                awstats.domainz.refererpages.html?  awstats.domainz.urlexit.html?
xserve:/usr/lib/cgi-bin/test#
and, its wierd the results here, ^M here and "?" in the above,
Code:
xserve:/usr/lib/cgi-bin/test# ls awstats.domainz.
awstats.domainz.alldomains.html^M     awstats.domainz.keyphrases.html^M     awstats.domainz.refererse.html^M
awstats.domainz.allhosts.html^M       awstats.domainz.keywords.html^M       awstats.domainz.unknownbrowser.html^M
awstats.domainz.alllogins.html^M      awstats.domainz.lasthosts.html^M      awstats.domainz.unknownip.html^M
awstats.domainz.allrobots.html^M      awstats.domainz.lastlogins.html^M     awstats.domainz.unknownos.html^M
awstats.domainz.browserdetail.html^M  awstats.domainz.lastrobots.html^M     awstats.domainz.urldetail.html^M
awstats.domainz.errors404.html        awstats.domainz.osdetail.html^M       awstats.domainz.urlentry.html^M
awstats.domainz.html^M                awstats.domainz.refererpages.html^M   awstats.domainz.urlexit.html^M
thks
 
Old 07-15-2005, 01:11 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Oh man, my bad ... must have been very tired, sorry. Didn't
get the fact that those were filenames, not the content of a file.

rename .html^M .html *.htm*


Cheers,
Tink
 
Old 07-16-2005, 08:28 PM   #7
nistelrooy
Member
 
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162

Original Poster
Rep: Reputation: 30
Hey Tinker, no worries, thanks for your help!

weird..
even the simple renaming had problems.

Code:
xserve:/usr/lib/cgi-bin# rename awstats.byon.alldomains.html^M awstats.byon.alldomains.html awstats.byon.alldomains.html^M
Bareword "awstats" not allowed while "strict subs" in use at (eval 1) line 1.
Bareword "byon" not allowed while "strict subs" in use at (eval 1) line 1.
Bareword "alldomains" not allowed while "strict subs" in use at (eval 1) line 1.
Bareword "html" not allowed while "strict subs" in use at (eval 1) line 1.
xserve:/usr/lib/cgi-bin#
Thanks again!
 
Old 07-16-2005, 09:02 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Invoke it just like I typed it mate ... otherwise you could
have just as well done them all 1 by 1 ;}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH USAGE: mass files rename sirpelidor Linux - General 8 09-20-2005 12:36 AM
df reports wrong disk usage Mathieu_G Linux - General 4 04-13-2005 02:44 PM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 05:55 AM


All times are GMT -5. The time now is 10:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration