LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 06-29-2012, 01:17 PM   #16
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738

Quote:
Originally Posted by brock_pace View Post
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/
 
Old 06-29-2012, 01:18 PM   #17
whysoserious
Member
 
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61

Rep: Reputation: Disabled
Maybe use cat instead of ls? Should read out the contents. Grep would be the way to go though.
 
Old 06-29-2012, 01:19 PM   #18
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
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.
 
Old 06-29-2012, 01:20 PM   #19
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by brock_pace View Post
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.
 
Old 06-29-2012, 01:25 PM   #20
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by whysoserious View Post
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?
 
Old 06-29-2012, 01:29 PM   #21
brock_pace
LQ Newbie
 
Registered: Jun 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
I decided on using SED, thanks for the help. ill get back to you and let you know how it goes.
 
Old 06-29-2012, 01:31 PM   #22
brock_pace
LQ Newbie
 
Registered: Jun 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
Is there a sed command that would get the name of the image?
 
Old 06-29-2012, 01:31 PM   #23
whysoserious
Member
 
Registered: May 2012
Location: London
Distribution: Debian and slackware for uni
Posts: 61

Rep: Reputation: Disabled
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.
 
Old 06-29-2012, 01:35 PM   #24
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by brock_pace View Post
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.)
 
Old 06-29-2012, 01:42 PM   #25
brock_pace
LQ Newbie
 
Registered: Jun 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-29-2012, 01:56 PM   #26
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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.
 
Old 06-29-2012, 01:56 PM   #27
brock_pace
LQ Newbie
 
Registered: Jun 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
does anybody have the sed/awk command that can extract the resolution
 
Old 06-29-2012, 01:58 PM   #28
brock_pace
LQ Newbie
 
Registered: Jun 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-29-2012, 02:15 PM   #29
joker20
Member
 
Registered: Sep 2004
Location: 127.0.0.1
Distribution: Slackware/Ubuntu/CentOS
Posts: 286

Rep: Reputation: 31
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 02:22 PM.
 
Old 06-29-2012, 02:51 PM   #30
brock_pace
LQ Newbie
 
Registered: Jun 2012
Posts: 23

Original Poster
Rep: Reputation: Disabled
can you explain your answer because I want to know the script that im sending.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Yesterday's date in unix priyophan Linux - Server 10 03-31-2011 06:33 PM
yesterday had sound ,now don't! ggeo Linux - Hardware 15 11-22-2006 06:24 PM
Unix/Linux Programmer: How do I get started? peaceofcrap2001 Programming 7 06-14-2005 03:24 AM
Yesterday I had audio, today I don't. mimsmall Linspire/Freespire 1 08-09-2004 05:43 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration