[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

script help

Posted on 2005-04-20
6
Medium Priority
?
144 Views
Last Modified: 2010-04-14
Hello.

There is a file  called filelist in folder t:\act\
that filelist has filenames like this

t:\S200504192330_62.txt
t:\S200504192330_63.txt
t:\S1200504192330_64.txt
t:\Current\S200504192330_66.txt

I want to delete the file which has current in the filename.In the above
example that would be the last one
How do i do this..

Any help would be greatly appreciated.

Thanks,
0
Comment
Question by:schinni
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:Mike R.
ID: 13830147
Um...I hate to sound simple...but how about...

del t:\Current\*.*

..or if the filename itself will have "current" in it, then ...

del t:\*current*.*

...maybe I am missing what your needs are :-)

M
0
 

Author Comment

by:schinni
ID: 13830278
No the thing this is not the file this is the data in the text file.
there is a text file it has all this data i want to get rid of the lines
which has "current"

t:\S200504192330_62.txt
t:\S200504192330_63.txt
t:\S1200504192330_64.txt
t:\Current\S200504192330_66.txt


I hope i am clear..Let me know if you still didn't understand..


0
 
LVL 3

Expert Comment

by:Mike R.
ID: 13830359
Hmmm..I do understand.  This may not help, but my Windows box has "Windows services for UNIX" installed on it...which, by default, includes all the unix scripting commands (some are included with default 2000...might give it a shot).

In UNIX (or on a Windows box with "Windows services for UNIX" installed) this is cake.

cat filename | sed /urrent/d > newfilename

...which list the contents of the file, deletes any lines with "urrent" in it (so it doesn't matter if the "c" is small or caps) and then dump the output to "newfilename".

Personally (being certified with UNIX and Windows) unix scripting is 1000 times easier and I think it is worth the hassle to install "Windows services for UNIX" just for that reason.

Otherwise, I would have to try and remember how to do BAT file scripting again :-)

Sorry for the limited help :-)
M
0
Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

 
LVL 3

Expert Comment

by:Mike R.
ID: 13830363
P.S.  "Windows services for UNIX" is a free download on the microsoft.com site.
0
 

Author Comment

by:schinni
ID: 13830425
Thanks ..I can't do that because there is so much  coding i lready did in windows and this
was the only part left over i will have to figure out something.
0
 
LVL 85

Accepted Solution

by:
oBdA earned 500 total points
ID: 13843265
Open a command prompt, and enter
cd /d t:\act
to change into the directory where your text file is.
Then type
type filelist.txt | find /i /v "T:\current" >filelist-nocurrent.txt
This will type the content of your filelist, and hand it to the find "find" command. The find command will only display lines that do *not* (/v) contain lines with "T:\current" in them. find's output is then redirected to a new file named filelist-nocurrent.txt.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question