Removing Files Starting With Dot

Hello,

I would like to remove those files:

MyDir/boo.tmp
MyDir/.zip.tmp

rm MyDir/*.tmp removes only boo.tmp but not .zip.tmp (No such file or directory).

I want to be able to remove any file that finishes with the .tmp extension even if the filename starts with . something.tmp

Thanks for your help :}


Similar Content



How To Rename A File In Linux

hello,

I am trying to rename the file by adding .txt extension and also
before renaming, I want to replace . in file with _

right now file looks like this mdm.201504021628

after execution of my script file name should be mdm_201504021628.txt


#!bin/bash
//reading all files from directory

files=$(hadoop fs

-ls /dl/data/landing/hivedb/lnd_attunity_kpi_db_backup/auth_master |
awk '!/^d/ {print $8}')

for f in $files; do

//using sed to replace . with _ and then feeding to hadoop fs command

sed 's/./\_/g' $f | hadoop fs -mv $f $f.txt

done

Thanks for your help in advance.

Need Help In Bash Scripting

I have two files which has exact same number of lines.
I want first line of first file should be filename of new file and content of this new file should be first line of second file.
Then second line of first file should be filename of again new file and content of this new file should be second line of second file.
then third line of first file should be filename of again new file and content of this new file should be third line of second file.
and so on...
I am trying to do it using for loop but I am not able to create two for loops.
This is what I have done
Code:
IFS=$'\n'
var=$(sed 's/\"http\(.*\)\/\(.*\).wav\"\,\".*/\2/g' 1797.csv) # filenames of all files
var2=$(sed 's/\"http\(.*\)\/\(.*\).wav\"\,\"\(.*\)\"$/\3/g' 1797.csv) # contents of all files
for j in $var;
do
#Here I do not know how to use $var2
done

Please help.

Remove Everything Before In Txt File?

So,

hopefully this is the right section to ask this in!

I'm looking to remove everything before in a txt file so long story short i've made a number wordlist with Crunch im basically wanting to remove all the unless numbers to numbers i want to start with.

so everything before 1232120000 i want to remove from the txt file i've heard you can do it with sed or awk im not familiar with using sed or awk.

In A Cpp Application I Am Deleting A File On A Partition, But Space Is Not Freeing..

1) deleting file using remove() call
2) no other hard link for the file
3) tried to close file descriptor using following scripts then remove() call
-------
for fd in $(ls /proc/$$/fd); do
case "$fd" in
0|1|2|255)
;;
*)
eval "exec $fd>&-"
;;
esac
done
-------

But space not freed

4) I tried with truncate() and then remove() call Now files deleted and space freed

Is it the only and right way to do this?

Remove Write-protected Regular File Without Permission

I wanted to delete a couple of files, so I did. Then I noticed that they were "write-protected". What does that mean? Why was I able to delete the files considering I wasn't the owner and the files did not have group write permission?

Code:
[Michael@devserver backup_database]$ ls -l
total 4344
-rw-r--r--. 1 apache apache   50639 Feb  6 05:42 2015_02_06_05_42_01.sql
-rw-r--r--. 1 apache apache  654623 Feb  6 05:45 2015_02_06_05_45_54.sql
-rw-r--r--. 1 apache apache 3738269 Feb  6 05:49 2015_02_06_05_49_02.sql
[Michael@devserver backup_database]$ rm *
rm: remove write-protected regular file `2015_02_06_05_42_01.sql'? y
rm: remove write-protected regular file `2015_02_06_05_45_54.sql'? y
rm: remove write-protected regular file `2015_02_06_05_49_02.sql'? y
[Michael@devserver backup_database]$ ls -l
total 0
[Michael@devserver backup_database]$

Finding Configuration Files.

Using package manager to remove configuration files while uninstalling a software is easy but how to find and remove configuration files of software that you install from external sources? suppose i compiled from source of installed an external package, how to find and remove those configuration files that these programs created?

Grep: Find Files That Do Not Have Multiple Different Strings

Hi all,

I'm trying to identify files that do not have matches for certain strings. FYI, these are files of DNA sequences and I'm trying to find those that are NOT sampled for any species by my group of interest (e.g., genes that are specific to that group of organisms).

I tried this code but it's actually yielding a list of files that DO match for my regexp.
Code:
for FILENAME in *.fas
do
grep -q -L ">PBAH" $FILENAME && grep -q -L ">SKOW" $FILENAME && grep -q -L ">CGRA" $FILENAME && echo $FILENAME
done

Basically I want to somehow go through and file files that do not contain ">PBAH" ">SKOW" or ">CGRA". Any assistance would be greatly appreciated!

Best,
Kevin

Syntax Error: Unexpected End Of File

Hi!
I wrote a script shell about changing IP of the httpd.conf from text file and saving a new httpd.conf file for all IPs in the text file. The code is below, Im using mremote on windows (RHEL Release 5.7), and getting this error:
./script1.sh: line 19: syntax error: unexpected end of file

Please help me about that error. Thanks!

(ps: line 19 is the last line in the code => done < "$filename" )

#!/bin/bash

DATE='date +%Y%m%d_%H:%M:%S'
NAME=httpd_ip_change
EXTENSION=conf
max=10

filename="$1"
while read -r line

for ((i=2; i<=$max; ++i ))

do
touch $NAME$i.$EXTENSION.$DATE

sed "s/<VirtualHost 10.11.92.81:80>/$line/g" ./httpd.conf > $NAME$i.$EXTENSION.$DATE

done < "$filename"

How To See The Files In Opt Directory

Hi

i need to see the files in opt directory

when i command /opt/filename/...

it is going without error in terminal but not able to open those files

thanks

pon

Linux Bulk Renaming Files

Hello Folks.

I'm searching for a easy way to rename multiple files from CLI but didn't find any easy way for me so I'm reaching out to you guys for help.

This is what I want to do (from CLII or script). I want to move files with a sequence number on the name of the files (msg0000, msg0001, msg0002 and so on) to let's say msg0066, msg0067 and so on. Each of this file name has two other files (msg0000.wav, msg0000.WAV and msg0000.txt).

The idea is to move them from one directory to another and following a sequence in the file names, is there a way I can do this pain free?

Any help on this matter will be greatly appreciates and I'm talking about over 100 files I need to move following the sequence of the receiving directory.

Thanks!