Can't Remove the File


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Can't Remove the File
# 1  
Old 07-13-2009
Can't Remove the File

Code:
$ ls -latr
total 112
drwxr-sr-x    3 ccalftdv ccalogrp        512 Sep 13 2006  dev
-rwxr-xr-x    1 ccalftdv ccalogrp       5586 Jun 08 15:55 cca_monthly_load_file.
ksh
-rwxr-xr-x    1 ccalftdv ccalogrp        680 Jun 25 08:50 cca_monthly_load_data.
ini
-rwxrwxr-x    1 ccalftdv ccalogrp        679 Jun 25 10:28 load_data.ini
drwxr-sr-x    4 ccalftdv ccalogrp        512 Jun 29 13:53 ..
-rw-r-----    1 ccalftdv ccalogrp       1298 Jun 30 08:26 dir_list_ccalloc_in.sh
-rw-r-----    1 ccalftdv ccalogrp       1298 Jun 30 08:26 dir_list_ccalloc_out.s
h
-rw-r-----    1 ccalftdv ccalogrp       1357 Jun 30 09:39 dir_list_eatv_out.sh
-rw-r--r--    1 ccalftdv ccalogrp          9 Jun 30 17:04 sample2.txtw
-rwxrwxrwx    1 ccalftdv ccalogrp       1570 Jul 01 14:35 dir_file_list.sh
-rwxr--r--    1 ccalftdv ccalogrp       5729 Jul 13 09:42 load_file.ksh
drwxr-sr-x    3 ccalftdv ccalogrp        512 Jul 13 09:44 .
$ who am i
ccalftdv    pts/5       Jul 13 09:32     
$

there is file sample2.txtw that i want to remove and can't removed by the rm command.
Code:
$ rm sample2.txtw
rm: sample2.txtw: A file or directory in the path name does not exist.
$ rm "sample2.txtw"
rm: sample2.txtw: A file or directory in the path name does not exist.
$

why can't i removed the file sample2.txtw?

thanks,
warren
# 2  
Old 07-13-2009
Code:
rm -i sample2.t*

# 3  
Old 07-13-2009
use,

rm -f sample2.txt*
# 4  
Old 07-13-2009
that works.

why can't it remove by a simple "rm sample2.txtw" command?
# 5  
Old 07-13-2009
Another one:

1. Type ls -i which will list the inode num
2. find . -inum <inode_num> -exec rm -f {} \;
# 6  
Old 07-13-2009
Possible, there is some junk char. in the file name.

First, just list that file separately:
ls -al sample2.txtw

Next try with a*:
ls -al sample2.txtw*

If it does not show up with the first but does show up on the second,
then that is not the full file name.
# 7  
Old 07-14-2009
To check for funny characters:

Code:
ls -lab

And:

ls -la | sed -n l

Once you know the exact filename it is safer to rename it first, then delete it.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Remove lines from File.A based on criteria in File.B

Hello, I have two files of the following form. I would like to remove from File.A where the first three colum matches values in File.B to give the output in File.C File.A 121 54321 PQR CAT 122 765431 ABC DOG 124 98765 ZXY TIGER 125 86432 GEF LION File.B 122 765431 ABC 125 86432 GEF... (4 Replies)
Discussion started by: Gussifinknottle
4 Replies

2. Shell Programming and Scripting

awk remove/grab lines from file with pattern from other file

Sorry for the weird title but i have the following problem. We have several files which have between 10000 and about 500000 lines in them. From these files we want to remove lines which contain a pattern which is located in another file (around 20000 lines, all EAN codes). We also want to get... (28 Replies)
Discussion started by: SDohmen
28 Replies

3. Shell Programming and Scripting

ksh Loop through file one, remove lines from file two

Good Afternoon, I start with a file named biglist.txt. I have another file smallerlist. txt I want to remove the lines from smallerlist.txt from biglist.txt and leave those lines that do not reside in smallerlist.txt. Thanks !! (2 Replies)
Discussion started by: popeye
2 Replies

4. Shell Programming and Scripting

Remove comments from file with specific file name extensions

Hello Unix board community, I have to program a shell script, but I am a complete noob so I hope I get some help here. The assignment is as follows: The program removes all comments regardless of formatting or language from files with specific file name extensions (php, css, js, ...).... (3 Replies)
Discussion started by: TheZeusMan
3 Replies

5. Shell Programming and Scripting

Remove bad records from file and move them into a file then send those via email

Hi my requirement is that i want pull the bad records from input file and move those records in to a seperate file. that file has to be sent via email.. any suggentions please (1 Reply)
Discussion started by: sxk4999
1 Replies

6. Shell Programming and Scripting

How to remove blank lines in a file and save the file with same name?

I have a text file which has blank lines. I want them to be removed before upload it to DB using SQL *Loader. Below is the command line, i use to remove blank lines. sed '/^ *$/d' /loc/test.txt If i use the below command to replace the file after removing the blank lines, it replace the... (6 Replies)
Discussion started by: vel4ever
6 Replies

7. Shell Programming and Scripting

Remove duplicate lines from first file comparing second file

Hi, I have two files with below data:: file1:- 123|aaa|ppp 445|fff|yyy 999|ttt|jjj 555|hhh|hhh file2:- 445|fff|yyy 555|hhh|hhh The records present in file1, not present in file 2 should be writtent to the out put file. output:- 123|aaa|ppp 999|ttt|jjj Is there any one line... (3 Replies)
Discussion started by: gani_85
3 Replies

8. Shell Programming and Scripting

need to remove 1st line of a file and save the file with same old name

Hi friends, I have a doubt, I am not sure whether it is possible ah nu. I am having a file(sample.txt) which contain 5 lines. I want to remove 1st line in the file and save the file with same old name (sample.txt). For removing 1st line i am using sed 1d filename But dono how to... (3 Replies)
Discussion started by: natraj005
3 Replies

9. UNIX for Dummies Questions & Answers

how to copy a file without remove the contents of the target file?

Hello every body, Kindly support me to "copy a file without remove the contents of the target file" Thanks in advance. :) Ahmed Amer Cairo,Egypt (2 Replies)
Discussion started by: ahmedamer12
2 Replies

10. Shell Programming and Scripting

Batch file to remove double quotes from a file

Hi I have to create a windows batch file which will read an input file and remove "double quotes" from each line of the file. For eg.If input file name is abcd.csv and contents is : "asasd,123123,213213,asd" "esfrf,dsfsdf,234324,sdfsdf" Then the batch file should remove "" from the... (11 Replies)
Discussion started by: akashtcs
11 Replies
Login or Register to Ask a Question