[SOLVED] started Unix yesterday, im 15 so i don't really know what i'm doing
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Regardless, please tell us what commands you have studied. We can help and give hints, but it is established policy not to do the assignment for you.
Here is a big hint: It can be done with a one-line SED command. The general form is this anything in <angle brackets>, means that you should insert the actual code.
Code:
sed -n '/<keyword>/ {<get the next line>; <remove the line feed + the word "resolution">; <print the resulting line>}' <filename> > <newfilename>
what i was thinking was i would set each file name to y and each resolution to z and then i would use echo to format them with the colon. I really just need to figure out how to set for y and zbecause what I have done already to get where i was at is this:
what i was thinking was i would set each file name to y and each resolution to z and then i would use echo to format them with the colon. I really just need to figure out how to set for y and zbecause what I have done already to get where i was at is this:
foreach x (`ls -1 | grep image `)
sed -n 1,2p $x
You said earlier that the data was in a file--if so, you can't list the data using ls
Is "foreach" a legal command?---I've never seen it before
no, I just dont understand the question. This is a really bad post because this is only my second day using any form of programming.
I thought the question was clear: You have a file with the stated contents, and you want a new file with the revised contents. I think you meant to say that you don't know how to do it.
What commands did they teach you before making this assignment?----OR: Did they send you to some documentation to look up the commands?
If you don't understand the question then how do you expect us to understand? Anyway, that script is wrong. Ls does not list contents of a file. What else have you tried, maybe if you tell us where you are stuck, instead of wanting the answer straight away. You will learn nothing like that sir.
yeah foreach is a legal command it just loops your commands, i think
According to a quick Google search, the term "foreach" is sometimes used to describe a type of loop. The actual command is "for". Using "man foreach" or "man -k foreach" finds nothing.**
"man" is one the very first Linux /Unix commands to learn. enter "man man" to get some details on how it works
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.