Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> The Rm Command, the syntax for input to a (rm) command
chili1000
post May 2 2003, 11:56 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 2-May 03
Member No.: 768



I want to, in a directory, delete all files but the ones ending with .c
somewhere I read that this line would do it:

rm $(ls -1|grep -v ".c$")

but I just get the following output:

Illegal variable name.

I understand the "ls -1|grep..." part, but not how I redirect that output
to an input for the rm command.

Can anyone out there help me?
Go to the top of the page
 
+Quote Post
jetblackz
post May 4 2003, 12:30 AM
Post #2


./configure
***

Group: Members
Posts: 98
Joined: 1-April 03
Member No.: 613



Why not this?

rm -f *.c


--------------------
Go to the top of the page
 
+Quote Post
Joey
post May 9 2003, 07:14 AM
Post #3


LinuxHelp Admin
*******

Group: Admin
Posts: 1,096
Joined: 18-September 02
Member No.: 1



rm -rf `ls -l |grep -v .c`

or

ls -l | grep -v .c | xargs rm -rf


should work. try it out on fake shit first though smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th December 2017 - 11:33 AM