Easy Bash Script Linux?! How?!
Hey
Can somebody help me? I need following bash script: All *.csv files i.e. this folder G4_SBLW/G4_500k_ke_1E_03_17000U_Entrainment_StPr_StT/data/ should run by "csv2tec" and give out a *.dat result file in the same folder. For example G4_SBLW/G4_500k_ke_1E_03_17000U_Entrainment_StPr_StT/data/Test1.csv G4_SBLW/G4_500k_ke_1E_03_17000U_Entrainment_StPr_StT/data/Test2.csv csv2tec Test1.csv Test1.dat csv2tec Test2.csv Test2.dat and so on. It is important for me that the filename of the *.csv ist the same as the *.dat file Can anyone help me? Thanks |
Hello and Welcome to LinuxQuestions,
What have you got already and where is it failing? LQ is all about helping users with problems/questions that relate to Linux but you'll not find many here that offer you ready made solutions. You should put in the work for yourself and in doing so you'll learn a lot more. Look into find, ls, grep and redirecting output to other commands. Kind regards, Eric |
Look at the 'find' command, and in particular its 'exec' option :)
EDIT: Oooor the ones EricTRA said :P you'd probably be able to do it in a way you understand more easily using his commands |
Code:
for thing in G4_SBLW/G4_500k_ke_1E_03_17000U_Entrainment_StPr_StT/data/* |
Quote:
And how are you helping the OP by handing him a solution he might not even understand? Have you considered for a minute that this might be homework? In my opinion it's a lot better to point a new user to the tools to use as I did. Not very helpful in my book. Kind regards, Eric |
man pages
Sounds like homework to me as well.
IF you can already get and work through a list of the files, check the man page for 'basename'. I am looking forward to seeing what you have so far, and finding out in what way it does not (yet)work. |
Hey guys
Thanks for your help. I can say it is no homework, i just had a lot to do at work these days so there was no time to think about scripting...After finishing my project I am having more time to learn bashscripting on myself! Thanks anyway |
You could try something like
Code:
cd <dir> |
All times are GMT -5. The time now is 10:21 PM. |