Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
06-29-2012, 12:17 PM
|
#16
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by brock_pace
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/
|
|
|
06-29-2012, 12:18 PM
|
#17
|
Member
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61
Rep:
|
Maybe use cat instead of ls? Should read out the contents. Grep would be the way to go though.
|
|
|
06-29-2012, 12:19 PM
|
#18
|
Member
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855
Rep:
|
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.
|
|
|
06-29-2012, 12:20 PM
|
#19
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by brock_pace
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.
|
|
|
06-29-2012, 12:25 PM
|
#20
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by whysoserious
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?
|
|
|
06-29-2012, 12:29 PM
|
#21
|
LQ Newbie
Registered: Jun 2012
Posts: 23
Original Poster
Rep:
|
I decided on using SED, thanks for the help. ill get back to you and let you know how it goes.
|
|
|
06-29-2012, 12:31 PM
|
#22
|
LQ Newbie
Registered: Jun 2012
Posts: 23
Original Poster
Rep:
|
Is there a sed command that would get the name of the image?
|
|
|
06-29-2012, 12:31 PM
|
#23
|
Member
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61
Rep:
|
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.
|
|
|
06-29-2012, 12:35 PM
|
#24
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by brock_pace
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.)
|
|
|
06-29-2012, 12:42 PM
|
#25
|
LQ Newbie
Registered: Jun 2012
Posts: 23
Original Poster
Rep:
|
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.
|
|
|
06-29-2012, 12:56 PM
|
#26
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
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.
|
|
|
06-29-2012, 12:56 PM
|
#27
|
LQ Newbie
Registered: Jun 2012
Posts: 23
Original Poster
Rep:
|
does anybody have the sed/awk command that can extract the resolution
|
|
|
06-29-2012, 12:58 PM
|
#28
|
LQ Newbie
Registered: Jun 2012
Posts: 23
Original Poster
Rep:
|
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.
|
|
|
06-29-2012, 01:15 PM
|
#29
|
Member
Registered: Sep 2004
Location: 127.0.0.1
Distribution: Slackware/Ubuntu/CentOS
Posts: 286
Rep:
|
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
Last edited by joker20; 06-29-2012 at 01:22 PM.
|
|
|
06-29-2012, 01:51 PM
|
#30
|
LQ Newbie
Registered: Jun 2012
Posts: 23
Original Poster
Rep:
|
can you explain your answer because I want to know the script that im sending.
|
|
|
All times are GMT -5. The time now is 09:41 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|