Applying a script to all the files of the find command
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Based on example file you need to make one small change to Format.awk due to the use of tabs:
Code:
gsub(/^[/* ]*/,"")
# to
gsub(/^[/* \t]*/,"")
And then as far as I can see it seems to work swimmingly
You may also wish to remove the reference to column in flamingo_l.sh as I was using this for better formatting on STDOUT so I could see what I was getting.
Well I am sure you want to do some of the work It is a fairly simple change ... let me know if you get stuck?
Obviously it will be in the Format.awk script file, and the hint is that the file name will only appear once in the DUMMY* file for all associated START/END combinations.
But due to this, if the file contains more changes than the file name is appearing only in the first row.
Below is the result from your sample files:
Code:
File Name|Application Name|Release Number|Function Name|Changes
./t1/t2/file1.java|ZZZZZ|1.1|f_job_no_aktive()|Added logic in f_job_no_aktive()
|BBBBB|2.7|f_bobby_annno_aktiv()|Added logic in f_fluff_no_aktiv()
./t1/t2/t3/file2.java|XXXXX|1.0|f_job_no_aktiv()|Added logic in f_job_no_aktiv()
|JJJJJ|0.05|f()|Added a little bit of logic in f_job_no_aktiv()
The output which am expecting is
Code:
File Name|Application Name|Release Number|Function Name|Changes
./t1/t2/file1.java|ZZZZZ|1.1|f_job_no_aktive()|Added logic in f_job_no_aktive()
./t1/t2/file1.java|BBBBB|2.7|f_bobby_annno_aktiv()|Added logic in f_fluff_no_aktiv()
./t1/t2/t3/file2.java|XXXXX|1.0|f_job_no_aktiv()|Added logic in f_job_no_aktiv()
./t1/t2/t3/file2.java|JJJJJ|0.05|f()|Added a little bit of logic in f_job_no_aktiv()
Also what is the use of this... as directly we can redirect the output to Sample file.
Yes you could but then you need to add your redirection to all lines that have to go to file. Admittedly in our example that is only 2 lines
but I find it looks cleaner. Also it has the added benefit of the reader seeing the file being opened and closed and should you choose
to add more lines later you can simply add them without remembering to redirect. Last bonus is that if you now wish to redirect a single line to STDOUT
you can point just that line at fd 3.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.