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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-12-2005, 12:23 PM
|
#1
|
|
Member
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162
Rep:
|
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!
|
|
|
|
07-12-2005, 03:19 PM
|
#2
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
try
fromdos < file > newfile
or
dos2unix < file > newfile
or
sed -i "s/^M/\n/g" file
Cheers,
Tink
|
|
|
|
07-13-2005, 10:45 AM
|
#3
|
|
Member
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162
Original Poster
Rep:
|
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".

|
|
|
|
07-13-2005, 01:35 PM
|
#4
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Was the wrong snippet, anyway. Sorry for that.
Try this one
sed -i -e 's/\r//g' file
|
|
|
|
07-15-2005, 11:52 AM
|
#5
|
|
Member
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162
Original Poster
Rep:
|
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

|
|
|
|
07-15-2005, 01:11 PM
|
#6
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
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
|
|
|
|
07-16-2005, 08:28 PM
|
#7
|
|
Member
Registered: Oct 2003
Location: Singapore
Distribution: debian
Posts: 162
Original Poster
Rep:
|
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!
|
|
|
|
07-16-2005, 09:02 PM
|
#8
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Invoke it just like I typed it mate ... otherwise you could
have just as well done them all 1 by 1 ;}
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:23 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|