Script to delete files line by line in .txt document

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to delete files line by line in .txt document
# 1  
Old 07-15-2014
Script to delete files line by line in .txt document


I am in need to delete files from a directory on a regular basis. I want to place all the files to be deleted in delete .txt file and require a script to delete files, line by line from this delete.txt file. Please help me with this script as am new to unix scripting.
# 2  
Old 07-16-2014
What have you done so far?

Moderator's Comments:
Mod Comment i transfer this thread over to the beginners section.

# 3  
Old 07-16-2014
Moderator's Comments:
Mod Comment Dear Users of this Board!

i would like to thank all the good and knowledgeable experts - you - for your ongoing support. You have helped countless people with your expertise and the willingness to share it.

Still, we have some rules in place and one of them is that homework and coursework is allowed only in the specialized board for this kind of questions. It is sometimes obvious if a question is homework/coursework and sometimes - like in this thread here - it is not.

In such a case we have established a simple course of action: someone, usually a moderator, asks what the thread opener has tried so far. If he answers this and shows his effort we at least have the proof that he did try to work out a solution, however inapt. We will try to correct what he did wrong, explian which misconceptions have led him astray, and so on.

Experience shows that the lazy (instead of inapt/uneducated) people, regardless of being student or not, will not answer such a question but istead wait to be spoon-fed a complete solution. As we - and i think we all can agree on this - do not want to support utter lazyness with our work we ask you to simply refrain from answering questions where a moderator or other user has asked such a question.

Please treat "What have you tried?" as a STOP-signal as long as the question is not answered by the thread owner!

Thank you for your consideration.


PS: @protocomm: I have hidden your answer for exactly this reason. Not, because it was wrong, but because it was premature. Thanks for understanding.

@balajesuri: Special thanks for holding up this rule.
These 2 Users Gave Thanks to bakunin For This Post:
# 4  
Old 07-16-2014
deleted post

Last edited by dagamier; 07-16-2014 at 01:36 PM.. Reason: deleting post
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How can i add each line from a txt file to different files in the same directory?

Hello, this is my first thread here :) So i have a text file that contains words in each line like abcd efgh ijkl mnop and i have 4 txt files, i want to add each line to each file, like file 1 gets abcd at the end; file 2 gets efgh at the end .... I tried with: cat test | while read -r... (6 Replies)
Discussion started by: azaiiez
6 Replies

2. UNIX for Dummies Questions & Answers

Split Every Line In Txt Into Separate Txt File, Named Same As The Line

Hi All Is there a way to export every line into new txt file where by the title of each txt output are same as the line ? I have this txt files containing names: Kandra Vanhooser Rhona Menefee Reynaldo Hutt Houston Rafferty Charmaine Lord Albertine Poucher Juana Maes Mitch Lobel... (2 Replies)
Discussion started by: Nexeu
2 Replies

3. Shell Programming and Scripting

How to read a two files, line by line in UNIX script and how to assign shell variable to awk ..?

Input are file and file1 file contains store.bal product.bal category.bal admin.bal file1 contains ::FFFF:BADC:CD28,::FFFF:558E:11C5,6,8,2,1,::FFFF:81C8:CA8B,::FFFF:BADC:CD28,1,0,0,0,::FFFF:81C8:11C5,2,1,0,0,::FFFF:81DC:3111,1,0,1,0 store.bal.... (2 Replies)
Discussion started by: veeruasu
2 Replies

4. Shell Programming and Scripting

Need to append the date | abcddate.txt to the first line of my txt file

I want to add/append the info in the following format to my.txt file. 20130702|abcd20130702.txt FN|SN|DOB I tried the below script but it throws me some exceptions. <#!/bin/sh dt = date '+%y%m%d'members; echo $dt+|+members+$dt; /usr/bin/awk -f BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Discussion started by: harik1982
6 Replies

5. Shell Programming and Scripting

how to read the contents of two files line by line and compare the line by line?

Hi All, I'm trying to figure out which are the trusted-ips and which are not using a script file.. I have a file named 'ip-list.txt' which contains some ip addresses and another file named 'trusted-ip-list.txt' which also contains some ip addresses. I want to read a line from... (4 Replies)
Discussion started by: mjavalkar
4 Replies

6. UNIX for Dummies Questions & Answers

shell script : log to txt and insert new line everytime

Hi, I have this script, while do ps ax|grep 5060 > log.txt echo " " sleep 1 done } I want to actually put a new line everytime the loop is executed in log.txt , but I do not know how to "embed" the echo " " inside the log.txt. (so to say... (1 Reply)
Discussion started by: peuceul
1 Replies

7. Shell Programming and Scripting

Create different txt files per line

Hi All, I have a text file1.txt which looks like a9 a3 a4 ... and i want to create a seperate .txt files per each line. For example, output1.txt will have only one element "a9" output2.txt will have only one element "a3" ... Thanks, (1 Reply)
Discussion started by: senayasma
1 Replies

8. Shell Programming and Scripting

linux shell script to take variables from two different files line by line

Friends I need to have a shell script which will feed variables from two different files line-by-line. For example, I have two files - permission and file_name. Contents of permission is - 644 755 .... contents of file_name /file1 /file2 ..... Now I want 644 permission will be... (4 Replies)
Discussion started by: atanubanerji
4 Replies

9. UNIX for Dummies Questions & Answers

Command to delete numbers at beginning of txt file line

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt awk 'NR%2==0' test1.txt >... (4 Replies)
Discussion started by: li_bi
4 Replies
Login or Register to Ask a Question

Featured Tech Videos