I have 2 external hdd in wich I have all my files. yesterday, I have copied all the files from hdd2 to hdd1 and I want to eliminate duplicates so I used FSLint to find them,now I want to make a shell script to delete all the files/entries (read from the log file) that begin with.
I have 2 external hdd in wich I have all my files.... yesterday, I have copied all the files from hdd2 to hdd1 and I want to eliminate duplicates so I used FSLint to find them, now, I have a txt file that looks like this:
Code: /media/My Book/!!!MIS DOCUMENTOS/Documentos/2 sep2003-jun2009 USB/!TESIS/TESIS/TESIS CVT LABVIEW Y CODEWARRIOR/LabVIEW85RuntimeEngineFull.exe /media/My Book/HDD_Toshiba/Borrable/Pen_Drive_4GB/Tesis/Super CD de la tesis/LabView/LabVIEW85RuntimeEngineFull.exe multiplied by millions of entries...
now I want to make a shell script to delete all the files/entries (read from the log file) that begin with:
/media/My Book/HDD_Toshiba/**** Since HDD_Toshiba is the folder in hdd1 (MyBook) that contains all the files from hdd2
I was transferring some files from my laptop (running FC6) to a server at my work (don't know what kind) with "scp -rpC" and it stalled, don't know why. Now when I try to delete the files from the server so I can start again I get the following error message
I am trying to write some small script file that will check if a USB stick is connected to my pc or not. I can't seem to get it to work, but I am sure it is a very simple fix.
I am running on Fedora core 10.Can anyone help me figure out what the problem is?If I run these lines through console it works fine (meaning, I type the commands in this file straight in the command line/console).
I am new to scripting, would like to have a script that tests whether a directory exists on remote host & display the message accordingly. The remote hostname can be provided by means of file containing list of hostnames. Can use rsh for connecting to remote host.I tried with couple of scripts by searching google but didn't get desired result. Please help me, below is my efforts, $file contains list of hostnames.
I have to delete a certain line of text from the a textfile via ubuntu's shell scripting.I have done research, and it seems that most people advocate the usage of sed /d option. sed makes does not edit the text file. Hence, most options I discovered involved the use of a temporary variable/textfile and then overwriting the old file with the temporary new file. Is there anyway whereby I can bypass the use of temporary storage containers? I hope there is any magical combination of commands to edit the file directly.
I have a directory called /data In this directory I have some files like abcejb.jar,12_ab_ejb.jar, shejb.jar, test I need a shell script like... 1st I want to check if there is any ejb file exists in the directory using some condition If ejb files exists I want to redirect the ejb files list to a file called list. Now I want to copy all the files in the list file to some remote system.
This script that I found online does the job it promises. it does convert the files to mp3 without an issue. What I need to include now is an if statement that says If $file.mp3 exists then delete $file.wav
Code: #!/bin/sh # name of this script: wav2mp3.sh # wav to mp3 # Credit to the script creator (Nikesh Jauhari):
After that I'm stumped as to how to do the if statement
I'm running CentOS 5.3 64bit and from the get go I've had problems with the Apache serverMore specifically, on what seems to be a random occurance, the apache server stops to respond.The process is still running, but nothing happens with it, and it is not responding.The /var/logs/httpd/error_log is blank for the occurance and only shows an entry after I give it a restartSo I'm a bit confused about what is going on.With that said, I need to make sure the httpd is working one way or another.I don't want to force a restart service every 10 minutes as this seems a bit too much.However, I do want to have the following:run a crond every minute to do:
rm -Rf /root/testarea/* wget http://ip/work.gif then check if work.gif exists.
I am in need of a way to check that the same file exists within two different directories using a filename as a variable. Here is the process which requires it: The script is reaches out (via ftp) and pulls down a file(s) and delete it afterwards. This is halfhazard because in the instance it doesnt pull down the file, yet still deletes it, we are up a creek. I am looking to pull it down to a temp location and then verify that file exists in the location in which it needs to be present to process before deleting it, adding a little extra layer for security. The script itself is finished.If I put a file name in manually it works perfect. I just need a way to pump the filename into the variable.
I need a script that dose the following checks if files exists by read input from a file then compares them to the files listed in the directory if they don’t exists the script would report back which file dose not exists. I also need to format the output so that files are grouped in different groups, group A, B, and C and etc based on file name. I would like the output of that do not exists files to be sorted based on second number in the file name than group according. I understand some of the basics of bash scripting something along of the lines of a loop and if statements might do the trick. Below is what I have so far. I don’t car so much about the script reporting back the file exists I prefer to only know if the file is missing and is less than 3 days old. Problem is if a file dose not exists in the reports file the test compares against the wrong file.
I am facing a problem in Windows due to a virus called Newfolder.exe which creats files with the same name as it's parent directory and an extension .exe and this happens for every directory in the entire hierarchy in the infected pen drive. The antivirus detects them, but is sucking slow. So I thought this is a good opportunity to use the concepts of the all mighty shell script to remove those as they follow the same pattern. Say my complete path is
The virus would have created an file with complete paths
If fol1 has two more directories fol11 and fol12 Then there would be two more .exe(virus created) in the following path
I have a shell script that need to create some files:
1) backup files of user passed in file ( that will be written by this shell ).
2) temp files that the shell will create and later delete/remove.
This shell script will be used from my local dir ( I am not a super or a sysadmin ). Users of this shell will call this script to run on their local files in their respective directories. When my script runs, it errors with the following:
I am trying to create a shell script, on taking a input file as parameter, which need to do 3 things
1) create a copy of existing file.
2) add a new line to the copied file.
3) strip off all the absolute paths inside the copied file
The first 2 points are straight forward. but i am finding it difficult to acheive the 3rd point. myself not very good with awk and sed. but gave it a shot in vain. For example, the input script consists of below,
I have 2 external hdd in wich I have all my files.... yesterday, I have copied all the files from hdd1 to hdd2 and I want to eliminate duplicates so I used FSLint to find them, now, I have a txt file that looks like this code...
now I want to make a shell script to delete all the files/entries (read from the log file) that begin with code...
I have requirement to delete some log files from a directory if a string"deletethisfile" is found.Then restart the application servers.1. Search for the string ?deletethisfile? in server.log file under a directory, If found 2. Stop that particular server.3. Delete the log file 4. Restart the server.
I would like to delete a single line from a file that contains many lines passing through the same values as the two parameters. Again, I would like to delete a single line and not all those that contain parameters. How can I make bash?
I am using Subversion version1.2 and need one favour. I have written code to delete particular revision from SVN Repository. Unfortunately, i couldn't delete particular version from repository. Any one can response me.. how to delete?
Quote:Originally Posted by topcatI would like to know how i can write a shell script to delete a line if a particular pattern exists?E.g. I have a text file with multiple lines. Say 1000s. in the following pattern.
If the firstname.lastname@example.org exists then the line "email@example.com:220.127.116.11:1 should be deleted from the file.I have a very similar question but I need to delete one line in a file which matches one very precise instance of a string only. Let's assume I have a file composed of thousands of lines and let's call the file chap-secrets. Let's take the following sample entries:
Code: #USERNAME SERVER PASSWORD IP pp pptpd blahblah *
Order of these lines are random... So I cannot delete line #19, for example... And you can see that top four lines I want to delete are pairs. So there might be some clever way to detect the lines, if a line has both "1.9" and "1.11", then delete the line... I am new to perl language. The following is the code I have now... I think I just need to write some code inside the while loop checking if I want to delete the line $dotline before I write to a NEW file.