Reading file and exclude in ksh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Reading file and exclude in ksh
# 1  
Old 02-05-2014
Reading file and exclude in ksh

I have a text file containing some file names. And I've a directory containing files with different name. I want to do some operaration (deleting) on the files which are NOT listed on the text file.
Im using KSH.


PLEASE HELP !!!!!
Urgent Help!!!!!
# 2  
Old 02-06-2014
ls /directory > all_files.txt
grep -vf no_delete.txt all_files.txt
execute the above to check
grep -vf no_delete.txt all_files.txt | xargs rm -f
execute the above to remove
# 3  
Old 02-06-2014
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.


Thank you.

The UNIX and Linux Forums
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. Shell Programming and Scripting

Reading the contents of the file and splitting using ksh

We're using a ksh script for installing one product. I've another config file, I'd need to read this configuration file from my main script Content of the Configuration file:... (2 Replies)
Discussion started by: bittu129
2 Replies

3. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies

4. Shell Programming and Scripting

reading value of concatenation with ksh

hello all, I am trying to read the value of a concatenation, the following code is displaying $word1 $word2 I want to display village home Thanks for (( i=1; i<=2; i++ )) do word1='village' word2='home' con="$"word"$i" echo $con done (5 Replies)
Discussion started by: wydadi
5 Replies

5. Shell Programming and Scripting

Problem reading into Variable using KSH

hi all, i create 1 file.txt and inside it contain : file1 file2 file3 file 4 then output that i want in my script: $1=file1 $2=file2 $3=file3 $4=file4 but,when write in ksh script with: while read folder set - $( echo ${folder} ) i=1 while (($i <= $#)) do ... (2 Replies)
Discussion started by: proghack
2 Replies

6. Shell Programming and Scripting

KSH: Reading a file line by line into multiple arrays

Hi - I have a file that contains data in this format:- #comment value1 value2 value3 #comment value4 value5 value6 value7 #comment value8 value9 I need to read value1, value2 and value3 into one array, value4 value5 value6 and value7 into another array and value8 and value9 into a 3rd... (2 Replies)
Discussion started by: sniper57
2 Replies

7. Shell Programming and Scripting

reading from file in ksh

hi, it seems i can read using cat file | while read line but when i tried reading using while read line < myfile then the last line kept on being returned why? thanks (2 Replies)
Discussion started by: JamesByars
2 Replies

8. UNIX for Dummies Questions & Answers

Ksh Storing Multiple Files and reading each line in each file.

How would I go about storing multiple file paths in a directory that begin like: 20080402* and run a loop that reads each line of each file thats in a given directory. So far this is what I have: #!/bin/ksh echo "ENTER Reprint Date (YYYYMMDD): " read ReprintDate echo ""... (1 Reply)
Discussion started by: developncode
1 Replies

9. Shell Programming and Scripting

reading lines in pairs from file in ksh

I need to read pairs of lines from a file and compare them. We can assume that the number of lines in the file is even. Can i do it in korn shell? (4 Replies)
Discussion started by: ytokar
4 Replies

10. Shell Programming and Scripting

Help reading an input file in KSH

First I' d like to say you guys are awesome. :) I have a word document that I cut and paste into Textpad and it removed all the fancy formatting which is fine with me. I WinScp'd it to the box and and called it inputfile.txt. Opened it in vi and don't see any special characters or stuff that... (2 Replies)
Discussion started by: zilla30066
2 Replies
Login or Register to Ask a Question