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.
I got this file progress titlebar updater thing to work, but now I want to go a step further:
Have it find what jobs are running, and append their progress to a file, and have that file be constantly updated and outputted. Right now, I'm just working on getting to the directory where the job was run from (in order to check the progress). What I currently have is:
What this does is first output the jobs currently set up, one line at a time, then it takes the ones containing "bleh" and removes the lines containing "blah", then grabs the 4th column (which contains file names) and then returns the directory in which the first file in the list is located. What I would like to do now is switch to that directory. I tried doing this:
find: missing argument to `-name'
bash: -printf: command not found
bash: cd: head: No such file or directory
Is there an easier way to do this?
Also - If I am going to get this to work, I need to be able to count the number of rows once "bleh" has been extracted and "blah" has been removed, then be able to repeatedly "sed -e '1d'" to remove the first line and then do the process again (cd to directo
can we please keep these in one thread... this is what.. the fourth thread for this issue?
those errors then:
you are trying to run two nested backticked commands, the first ` will start the command, but the next one, which you believe will give a second command for the find will end the current one. you want
cd ( find . -name ( head -n 1 ) -printf %h )
but you're actually doing:
cd ( find . -iname ) head -n 1 ( -printf %h )
which makes even less sense. you have also provided no data for that head command if it did work... what is head meant to print the first line of??
Last edited by acid_kewpie; 06-12-2003 at 03:19 PM.
Maybe try "find ./ 'head -n 1' -print %h" or man find and head to check how you have to quote those arguements. Or use a variable instead of 'head -n 1'.
This isn't the same issue, I'm making something different and better.
head does what it says, it grabs the first line of the text that is left.
When I do:
myjobs | grep "bleh" | awk '{ print $4 }' | find `head -n 1`
it correctly searches for and finds the file whose name matches the first line, fourth column of the text that's left from the output of "myjobs" after the lines containing "bleh" have been extracted.
Quote:
Originally posted by acid_kewpie can we please keep these in one thread... this is what.. the fourth thread for this issue?
those errors then:
you are trying to run two nested backticked commands, the first ` will start the command, but the next one, which you believe will give a second command for the find will end the current one. you want
cd ( find . -name ( head -n 1 ) -printf %h )
but you're actually doing:
cd ( find . -iname ) head -n 1 ( -printf %h )
which makes even less sense. you have also provided no data for that head command if it did work... what is head meant to print the first line of??
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.