File with a weird name 'q'


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers File with a weird name 'q'
# 1  
Old 08-05-2008
Question File with a weird name 'q'

All,

I have the following listing of files

Code:
$ ls -lrt
-rw-rw-rw-   1 user1  group1       335691  Aug  4 17:45 script1.sh
-rw-rw-rw-   1 user1  group1         648     Aug  4 17:45 try,csv
-rw-rw-rw-   1 user1  group1      1381275  Aug  4 17:45 test.txt
-rw-rw-rw-   1 user1  group1      1381275  Aug  5 07:42q

Please let me know what the last file is and how do I delete it?

Thanks,
Rahul.
# 2  
Old 08-05-2008
Probably caused by a typo.
Try quoting critical characters
Code:
$  rm 07\:42q

# 3  
Old 08-05-2008
If the file name contains control characters, it's pretty hard to troubleshoot directly, but see if you can come up with a wildcard which matches only that file. For example, if any of the following commands lists only that file and no others, change the echo to rm and repeat the command.

Code:
echo ?  # lists all files with exactly one character in the name
echo ??   # two characters
echo ???  # three characters (etc
echo *[! -~]*  # any control characters in the name?

# 4  
Old 08-05-2008
Oh sorry, haven't looked close enough.
It looks, gathered from the size, to be a copy of test.txt.
You can run a diff or md5sum on both files to see if it really is an exact copy.
# 5  
Old 08-05-2008
Yes it is a copy of test.txt.

It was created when I was trying to quit vi when I had the test.txt opened.

The point is what is the name of the file now? How do I perform any operation on this file when I cannot pass its name to a command? I cannot perform a diff if the filename is not known.

Rahul.
# 6  
Old 08-05-2008
I quit bash and opened ksh shell. I provided the following command.
Note: Just before I typed q, I typed backspace on my keyboard which gave these characters '^?'

$ ls -lrt ^?q
-rw-rw-rw- 1 cdtnmdb asg 1381275 Aug 5 07:42q

This has listed the file. Weird character before the file name.

Regards,
Rahul.
# 7  
Old 08-05-2008
To show the funny characters:
ls -lab *q

In this case because there are no other filenames ending in "q", all you need to know is how many funny characters.

Then rename the file:
e.g. If there is just one character:

mv ?q junk
rm -i junk
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Weird Error (: No such file or directory)

Hi Everyone, I am trying to make this script to use, to find out the DAHDI channel status. Every thing works fine, I even get proper results, however I have this weird error that comes along. Can someone please help me. Thanks a lot. #!/bin/bash # Color to set the test to when a channel is... (3 Replies)
Discussion started by: jeetz
3 Replies

2. Shell Programming and Scripting

Weird ? symbol coming through-sending text file

Hi All, When I am trying to send a text file through Unix,I get a weird symbol in the .txt file. The symbol is ? in a box (square)....which is making the file unloadable. Please help me with the solution. Thanks in advance Gopi (1 Reply)
Discussion started by: gopi.palleti
1 Replies

3. UNIX for Dummies Questions & Answers

Weird Error moving a file

Hi, We are running into very weird error on AIX. Target directory exists on NFS. We have one script runs every 5 mins on our system. This script is running for 5 years for now without any issuess. Followig is the snapshot of the script : stmt_cnt=$(ls -1 ${1}/${2}|wc -l) if ;... (7 Replies)
Discussion started by: himihir2000
7 Replies

4. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

5. Shell Programming and Scripting

Find files older than X with a weird file format

I have an issue with a korn shell script that I am writing. The script parses through a configuration file which lists a heap of path/directories for some files which need to be FTP'd. Now the script needs to check whether there are any files which have not been processed and are X minutes old. ... (2 Replies)
Discussion started by: MickAAA
2 Replies

6. UNIX for Advanced & Expert Users

Weird working of File Watcher job

I have JIL script like the one below insert_job:F_SAMPLE job_type:f machine:PC001 owner:asla@PC001 watch_file:/home/shah/one/sample.trg watch_interval:90 alarm_if_fail:1Here my question is, there is a directory one under that file needs to be watched sample.trg..! but directory one owned... (0 Replies)
Discussion started by: shahnazurs
0 Replies

7. AIX

weird file list problem

When I do a file list in my spooler directory, I get the following information #ls -l |pg -rw-rw-rw- 1 user1 ugroups 831690 Apr 03 12:52 K6A80403125051.prn :res 2330479869879093344 ext 2330477052380546512 align -rw-rw-rw- 1 user1 ugroups 5900 Apr 03 14:19 K6A80403141858.idx :res... (8 Replies)
Discussion started by: jmmora
8 Replies

8. Shell Programming and Scripting

Weird Ascii characters in file names

Hi. I have files in my OS that has weird file names with not-conventional ascii characters. I would like to run them but I can't refer them. I know the ascii # of the problematic characters. I can't change their name since it belongs to a 3rd party program... but I want to run it. is there... (2 Replies)
Discussion started by: yamsin789
2 Replies

9. UNIX for Dummies Questions & Answers

How to delete a weird file name

Hi, How do I delete a file name that starts with a hypen? e.g. -unix_file_2006_10_3 I always get an erroe when I use rm command. I am using Solaris. Thanks, Hi, One of the Unix books I read to remove this weird file suggest to use: "rm ./-unix_file_2006_10_3" which I did today and file... (3 Replies)
Discussion started by: XZOR
3 Replies

10. UNIX for Dummies Questions & Answers

Weird File

$ls -lrt -rw-r--r-- 1 rathodr users 1757 Jan 6 13:36 cleanup.archive.files.pl -rwxr-xr-x 1 rathodr users 20503 Jan 6 13:52 alarm.control.pl -rw-r--r-- 1 rathodr users 20503 Jan 9 04:52q The last file seems to be a weird file. I am not sure how was it created. Maybe... (5 Replies)
Discussion started by: rahulrathod
5 Replies
Login or Register to Ask a Question