find

Find occurrences of a string in files and display “filename - count” through batch file

我是研究僧i 提交于 2019-12-14 03:13:50
问题 Batch file to search every single subfolder and every single file inside a directory and count the number of times a particular string is present in each file. Would be useful if output is "filename - count". Can do find /c "Microsoft" *.txt This works if all the files are in one folder. How do you make the find loop through all the subfolders and each of its files and display the same result. Findstr has /s which does that, doesnt work on find. 回答1: From command line: for /F "delims=" %G in

Looking for an Applescript to find files and move them to different folder

岁酱吖の 提交于 2019-12-14 03:05:12
问题 I'm trying to find a script to find and move files to a different folder. I've got a folder with hundreds pictures like this: PA-600-01.jpg, PA-600-02.jpg, PA-600-03.jpg, PA-600-04.jpg, PA-601-01.jpg, PA-601-02.jpg, PA-601-03.jpg, PA-602-01.jpg, PA-602-02.jpg, PA-602-03.jpg, PA-602-04.jpg, PA-602-05.jpg I want to move all the pictures with PA-600 ( so PA-600-01.jpg, PA-600-02.jpg, PA-600-03.jpg and PA-600-04.jpg ) on a folder (new or already existing, the easier...) named PA-600 , move all

jQuery split at HTML tags i.e split at every instance of the h2 tags?

不想你离开。 提交于 2019-12-14 02:53:40
问题 I am trying to find all <h2> tags the split them and join them with <a href=''></a> around them. I am so close but stuck. <script type="application/javascript"> $(document).ready(function() { // finds all h2's within wrapper div grabs the text splits at ? and applies a links around each one var al = $('#wrapper').find('h2').text().split("?").join("?</a><br /> <a href='#'>"); // Add all the split h2's from the variable above al to a div called .text $('.text').html('<ul>' + al + '</ul>'); });

Is MPL pos an undocumented metafunction?

こ雲淡風輕ζ 提交于 2019-12-14 01:23:28
问题 There is the following example code in the BOOST MPL documentation of the find algorithm: typedef vector<char,int,unsigned,long,unsigned long> types; typedef find<types,unsigned>::type iter; ... BOOST_MPL_ASSERT_RELATION( iter::pos::value, ==, 2 ); However, I cannot find the documentation for the iterator's pos metafunction. Can I use it reliably? I'd like to use it somehow as: typedef vector<type1, type2, type3> types; template <typename T> void File::write(T value) { BOOST_MPL_ASSERT(

Compare two files in bash

余生长醉 提交于 2019-12-13 18:26:14
问题 I have two files tmp1.txt and tmp2.txt tmp1.txt has aaa.txt bbb.txt ccc.txt ddd.txt tmp2.txt has /tmp/test1/aaa.txt /tmp/test1/aac.txt /tmp/test2/bbb.txt /tmp/test1/ccc.txt I want to check if the files in tmp1.txt exists in tmp2.txt and if it exists display which one it has so it displays something similar to this aaa.txt: test1 bbb.txt: test2 ccc.txt: test1 Thanks 回答1: Using awk : awk -F/ 'FNR==NR {a[$1];next} $NF in a {print $NF ": " $(NF-1)}' tmp1.txt tmp2.txt aaa.txt: test1 bbb.txt: test2

Rails finding all posts with certain tags without using acts_as_taggable

本秂侑毒 提交于 2019-12-13 17:33:38
问题 So I'm trying to learn rails and I don't want to cheat just yet. post model: class Post < ActiveRecord::Base has_many :features has_many :tags, :through => :features end tag model: class Tag < ActiveRecord::Base has_many :features has_many :posts, :through => :features end join table: class Feature < ActiveRecord::Base belongs_to :tag belongs_to :post end I already know how to associate posts with tags by doing: Post.find_by_id(1) << Tag.first Now, I'm stuck on searching for posts with

Find files older than FILE without including FILE

这一生的挚爱 提交于 2019-12-13 14:23:39
问题 I have a plan to use find to give me a list of files that are older than some FILE and then use xargs (or -exec ) to move the files to somewhere else. Moving stuff is not a problem; | xargs mv {} ~/trash works fine. Now, if I try to use ! -newer FILE , then FILE is included in the list, which I do not want! The functionality of that command argument does indeed make sense logically, though, because 'not newer' could very well be interpreted as "same or older", like here: $ find . ! -newer

Implementing the matlab find function [closed]

爷,独闯天下 提交于 2019-12-13 11:16:33
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am trying to find the coordinates of all non zero elements in a matrix, in MATLAB. I know that find makes this very easy. The problem is that I need to define the length of my matrix before I can fill it up. I believe this is impossible using find , since it will make its own vector. So I have to

Getting the middle character in a odd length string

故事扮演 提交于 2019-12-13 10:18:08
问题 def get_middle_character(odd_string): variable = len(odd_string) x = str((variable/2)) middle_character = odd_string.find(x) middle_character2 = odd_string[middle_character] return middle_character2 def main(): print('Enter a odd length string: ') odd_string = input() print('The middle character is', get_middle_character(odd_string)) main() I need to figure out how to print the middle character in a given odd length string. But when I run this code, I only get the last character. What is the

removing corrupted files using a bash script [closed]

℡╲_俬逩灬. 提交于 2019-12-13 10:01:08
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have many "bad" files after recover my broken hdd. I need script in bash which helps me remove bad files like zero byte consists only (00 00 00 00 00 ...) 回答1: It's better to use find : find -maxdepth 1 -type f