LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   started Unix yesterday, im 15 so i don't really know what i'm doing (https://www.linuxquestions.org/questions/linux-newbie-8/started-unix-yesterday-im-15-so-i-dont-really-know-what-im-doing-4175414028/)

pixellany 06-29-2012 12:17 PM

Quote:

Originally Posted by brock_pace (Post 4715128)
they told me nothing, on my first day they just said do this, i knew no commands everything ive done so far has been from stuff ive looked up online.

that's OK---obviously, they want you to start doing your own research.

In addition to the link on SED, also go here: http://tldp.org Get the Bash Guide for Beginners by Machtelt Garrels


Note, I've been assuming Linux, but you did say Unix---what computers are you using and and what Operating system is installed/

whysoserious 06-29-2012 12:18 PM

Maybe use cat instead of ls? Should read out the contents. Grep would be the way to go though.

honeybadger 06-29-2012 12:19 PM

I relly did not undertastand what you are trying to say here. Is anyone able to see the images that the OP is posted?
If you let us know what exactly you see on the computer we can help you.
Do not worry we all start at some point and thoes are the times (mostly) when we do not have an idea of what we are doing.

pixellany 06-29-2012 12:20 PM

Quote:

Originally Posted by brock_pace (Post 4715132)
im stuck because i dont know how to set the file name as a variable

Hint: you don't need to. you don't need to set any variables. Did you look at my SED suggestion?

'nother hint: You're not concerned with the filename---you need to work on the contents. EXCEPT---The file contains filenames!! No matter---you still do not need to set any variables.

pixellany 06-29-2012 12:25 PM

Quote:

Originally Posted by whysoserious (Post 4715139)
Maybe use cat instead of ls? Should read out the contents. Grep would be the way to go though.

If you can use GREP to parse a file, combine pairs of lines, and then remove part of the text, I'll buy you a year's supply of your favorite junk food or recreational chemical.

I stated that this can be done with a one-line SED statement---does anyone disagree?

brock_pace 06-29-2012 12:29 PM

I decided on using SED, thanks for the help. ill get back to you and let you know how it goes.

brock_pace 06-29-2012 12:31 PM

Is there a sed command that would get the name of the image?

whysoserious 06-29-2012 12:31 PM

Not just Grep, maybe you need to get off those recreational chemicals you are offering me. How can Grep parse files. I said it would be included in the code, not gona give the whole code. He won't learn anything... I could be wrong but that's the linux learning curve.

pixellany 06-29-2012 12:35 PM

Quote:

Originally Posted by brock_pace (Post 4715153)
Is there a sed command that would get the name of the image?

Yes

(I'm assuming that you mean look for "IMAGE1", "IMAGE2", etc. in the file.)

brock_pace 06-29-2012 12:42 PM

yo what up. I just got the first half of it.

so i have:

image1.txt
image2.txt
image3.txt

now i just need to use sed to extract the resolution. thanks for all of your help.

---------- Post added 06-29-12 at 09:43 AM ----------

i figued that it would be easier to use the actual file name rather than the text whithin the file.

pixellany 06-29-2012 12:56 PM

You're on a roll!!----It seems you learn quickly. Please keep us updated and--as soon as you have any code--post it here.

brock_pace 06-29-2012 12:56 PM

does anybody have the sed/awk command that can extract the resolution

brock_pace 06-29-2012 12:58 PM

oh, btw i used echo $x to get the file names instead of my variable method because I had already set it. I still don't know how to get the resolutions though.

joker20 06-29-2012 01:15 PM

i hate to just give the answer like this but given that he stated hes just learning i feel like i could be helping by showing an example...

theres probably a shorter way to do this but using sed is your best bet and this is what i came up with...

Quote:

sed 's/File\: //g' *INFILENAME* | sed 's/Resolution\: //g' | sed 'N;s/\n/ /g' > *OUTFILENAME*
edit: posted this w/o refreshing...seems hes getting close and i highly encourage to find an alternate way to get the same result, im sure there is plenty
and if not then read some sed tutorials and get a good understanding of the syntax

brock_pace 06-29-2012 01:51 PM

can you explain your answer because I want to know the script that im sending.


All times are GMT -5. The time now is 04:14 PM.