trailing question mark in filename


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers trailing question mark in filename
# 1  
Old 06-07-2006
trailing question mark in filename

I have a script(ex.sh) with one line in it, running in bash shell.

ls -l > /usr/ngasi/contexts/tdevoe/private/ex.txt

when I run it , it creates the file with a trailing question mark

-rwx------ 1 tdevoe webapp 59 Jun 7 06:42 ex.sh
-rw------- 1 tdevoe webapp 3761 Jun 7 06:42 ex.txt?

why?
# 2  
Old 06-08-2006
I think you've got gremlins.

Image

"Gremlin" is a colorful term for strange, nonprinting characters that your text editor might not show you but can really foul things up anyway. That's not a literal question mark, it's ls thinking "What the hell is that? I can't print that!" so it just prints a question mark instead. Gremlin characters are even more annoying in C files, the compiler just dies.

I often get lots of gremlins from copy/pasting stuff from the internet. If that's how you ended up with that one, there's probably lots more.

You can get rid of gremlins like:
Code:
tr -d '[\000-\010\014\016-\037\177]' < messed-up.sh > fixed.sh

This will strip out any characters but ASCII printing characters, newline, carriage return, tab, and space.

P.S. Don't feed them
# 3  
Old 06-09-2006
A lot of editors have a hex display mode. I use Ultra Edit for finding embedded junk characters, and dos2ux to clean up files brought over from Windows systems.
# 4  
Old 06-09-2006
You could try "ls -b" to display any gremlin characters in octal notation (\nnn)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nawk command not working for Question mark (?)

Hi Folks, I am facing an issue with nawk command. The data is as below: ABC0022,BASC,Scene Package,INR,02May17,XXX4266,be?. Hotel,3,AW01,Twin Room,61272,41308,39590,39590,X,X ABC0022,BASC,Scene Package,INR,02May17,XXX4266,be?. Hotel,3,AW02,Twin Room with Balcony,9272,85638,4520,9590,X,X... (1 Reply)
Discussion started by: kirans.229
1 Replies

2. Shell Programming and Scripting

Displaying trailing spaces in a filename; Korn Shell

Korn Shell on AIX 6.1 In one of our directories, we have 2 files with same names but one of those file's name has 3 trailing spaces ls *.ctl rconf.ctl rconf.ctl #this file has 3 trailing spaces Is there any way we could display these trailing spaces ? (6 Replies)
Discussion started by: polavan
6 Replies

3. UNIX for Dummies Questions & Answers

Removing the trailing date from a filename

Hi I have 3 files (say) in a folder as in the example below abc_01012011.csv def_01012011.csv xyz_01012011.csv I need to move these files to a different folder as follows abc.csv def.csv xyz.csv I am trying to put together a script with a for loop which reads the source filenames... (5 Replies)
Discussion started by: bobsn
5 Replies

4. Shell Programming and Scripting

Backwards question mark appearing in FTP'd file

Hi all, I'm trying to FTP what looks like a simple .txt file from my Windows XP desktop to my UNIX server. I've tried using several programs to do this including UltraEdit and FTP Commander. I have tried sending it ascii, binary and even let the program decide. But every time it arrives in UNIX... (4 Replies)
Discussion started by: Korn0474
4 Replies

5. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

6. Shell Programming and Scripting

Question mark in filename

Dear All, I am trying to run some commands and I am getting question mark in filename as output files. Which is not a literal question mark however it is not standard output format for UNIX and it can not print it. The output files are extended with ? For example,... (2 Replies)
Discussion started by: hsmart
2 Replies

7. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies

8. Shell Programming and Scripting

~mark

hi guys I am studing unix and I have some questions to ask. what is the diffrence beteween man and info? how and when we use ~ mark? tanks henk ;) (1 Reply)
Discussion started by: henk
1 Replies

9. UNIX for Dummies Questions & Answers

? question mark, how to get back to the root directory

hiyas I am trying to get back to the root directory: I went into MAIL directory and now I can't get back to the root directory. What are the commands... I have '?' coming up and I cannot proceed with this, HELP Cheers (1 Reply)
Discussion started by: etravels
1 Replies
Login or Register to Ask a Question