Sponsored Content
Full Discussion: Nested sed commands
Top Forums Shell Programming and Scripting Nested sed commands Post 302930341 by sea on Friday 2nd of January 2015 12:02:38 PM
Old 01-02-2015
uhm am i misunderstanding something?
At first i thought the command just prints that list, now i assume it expects the user to do some input?

By my thinking, those grep and awk commands should work just as good as sed.
But, since it requires/expects user interaction, the output might remain empty until the choice was done.

If that applies, you could try to redirect the output to a file abort the task and parse the files output, catch the return value, and call the command again, this time with here-doc to pass the selected option.

hth

---------- Post updated at 18:02 ---------- Previous update was at 17:58 ----------

Quote:
Originally Posted by Nic2015
No index 3 is what i have to found and this value can change next time if i call this statement again. gphoto returns the current setting of the ISO on the digital camera and this can changing. So next time it could be the index 1, then 10 etc...
In that case you should make it a script:
Code:
#!/bin/bash
gphoto2 --get-config /main/$1 | \
    grep -v [LTC][auy]] | \
    grep ^$2" " | \
    awk '{print $3}'

Place it in (as example for yourself): $HOME/bin, lets say photo-conf.sh.
Give it execution falg:
Code:
chmod +x $HOME/bin/photo-conf.sh

And call it:
Code:
photo-conf.sh "imsettings/iso" 3

hth
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed commands

I have a configuration file that when a certain script runs in updates. I want to use sed and can't seem to get the syntax right. A line from the configuration file looks like: DATE=20040909 12:00:10 When the script is run I want to change the date and time, i.e. removing the previous... (7 Replies)
Discussion started by: dbrundrett
7 Replies

2. Shell Programming and Scripting

multiple sed commands

hello! I have a few sed commands sed '/^$/d' < $1 > tmp.t sed '/^ \{3,\}/d' < tmp.t > tmp1.txt ..... how can I write them in a single line? sed '/^$/d' < $1 > | '/^ \{3,\}/d' < $1 > tmp1.txt any idea? thanks. (5 Replies)
Discussion started by: george_
5 Replies

3. UNIX for Dummies Questions & Answers

combining sed commands

I would like to change the lines: originalline1 originalline2 to: originalline1new originalline1newline originalline2new originalline2newline To do this, id like to combine the commands: sed 's/^/&new/g' file > newfile1 and sed '/^/ a\\ newline\\ \\ (2 Replies)
Discussion started by: Dave724001
2 Replies

4. Shell Programming and Scripting

Running sed commands

Hello I need to run some sed commands but it involves "/" in the substitute or delete, any ideas how I get round the problem. Example: cat file1.txt | sed -e '/</Header>/d' > file2.txt This errors due to the forward slash before the Header text. Thanks (3 Replies)
Discussion started by: Dolph
3 Replies

5. Shell Programming and Scripting

merging sed commands

Hi, I've a shell that uses two sed commands to tailor a file. sed 's/ */ /g' | sed 's/%/%%/g' Is it possible to merge this in to a single sed? Thanks! (2 Replies)
Discussion started by: dvah
2 Replies

6. UNIX for Dummies Questions & Answers

Bourne-sh (not bash) question about nested loops and sed

Here's the input: alpha, numeric or alphanumeric string ("line 1 string") numeric string ("line 2 string") numeric string ("line 3 string") numeric string ("line 4 string") ... where - each numeric string is in a pattern that can be matched with RE but - there can be any number of... (2 Replies)
Discussion started by: uiop44
2 Replies

7. Shell Programming and Scripting

sed help - nested pattern

Hello, I am very new to Unix and using sed so I'm struggling a little bit with this command and was hoping someone could help me out. I want to find a nested pattern in a file and replace some text in that file with text from another file. For example, in file one I have something like... (11 Replies)
Discussion started by: planetary12
11 Replies

8. Shell Programming and Scripting

Grouping sed commands

Hello, would you please help me with why my SED command file is outputting the entire input file instead of only the text that I'm trying to block? cat testfile O 111111111-00 DUE-DATE METHOD: FREQUENCY: O 222222222-00 DUE-DATE METHOD: FREQUENCY: O 333333333-02 DUE-DATE METHOD:... (4 Replies)
Discussion started by: lneedh1
4 Replies

9. Shell Programming and Scripting

Complex bash/sed, variables and nested quotes

Ok, this one isn't for everybody, it's pretty tough and I've spent a good deal of time on it without figuring it out yet. Can anybody get this script to work: #!/bin/bash cq_fname="%let outputfile="/user/cq_"$1".csv";" sed "29s/.*/\"$cq_fname\"/" file1.sas >... (3 Replies)
Discussion started by: nocloud
3 Replies

10. Homework & Coursework Questions

Sed, matching nested brackets and deleting

1. The problem statement, all variables and given/known data: I have to write a script using sed, which delete everything between curly brackets and the brackets themself. The brackets might be nested. The input-file is: aaa { bbb ccc { ddd eee } fff { ... (2 Replies)
Discussion started by: FuzzyGnome
2 Replies
sane-gphoto2(5) 					   SANE Scanner Access Now Easy 					   sane-gphoto2(5)

NAME
sane-gphoto2 - SANE backend for gphoto2 supported cameras DESCRIPTION
The sane-gphoto2 library implements a SANE (Scanner Access Now Easy) backend that provides access to the digital cameras supported by gphoto2. This backend has only been tested with a handful of cameras so far. Patches to support other models are welcome. Because of the limited testing of this backend, it is commented out in /etc/sane.d/dll.conf by default. Either the comment character must be removed or the backend must be called explicitly. E.g. `scanimage -d gphoto2' or `xscanimage gphoto2'. DEVICE NAMES
The current version of the backend only allows one camera to be connected. The device name is always "0". CONFIGURATION
The contents of the gphoto2.conf specify the characteristics of the camera to be used. Resolutions (high resolution, low resolution, and thumbnail size) are required since they are needed by the sane frontends, but can't be obtained through the gphoto2 interface. Valid ports and cameras can be obtained by "gphoto2 --list-cameras" and "gphoto2 --list-ports". The dumpinquiry line causes some information about the camera to be printed. Empty lines and lines starting with a hash mark (#) are ignored. A sample configuration file is shown below: The "topfolder" line specifies the "fixed" part of the file path. For example, on the Kodak DC-240, files are stored in the directory /DCIM/100DC240. The /DCIM portion is constant, but 100DC240 will change and must be read from the camera. In this case, the line would read "topfolder=/DCIM" Some cameras don't implement a file structure and store all pictures in the "/" directory. This is indicated by setting "subdirs=0" with "topfolder=/" port=usb: camera=Kodak DC240 # this is a comment high_resolution=1280x960 low_resolution=640x480 thumb_resolution=160x120 dumpinquiry FILES
/etc/sane.d/gphoto2.conf The backend configuration file (see also description of SANE_CONFIG_DIR below). /usr/lib64/sane/libsane-gphoto2.a The static library implementing this backend. /usr/lib64/sane/libsane-gphoto2.so The shared library implementing this backend (present on systems that support dynamic loading). ENVIRONMENT
SANE_CONFIG_DIR This environment variable specifies the list of directories that may contain the configuration file. Under UNIX, the directories are separated by a colon (`:'), under OS/2, they are separated by a semi-colon (`;'). If this variable is not set, the configura- tion file is searched in two default directories: first, the current working directory (".") and then in /etc/sane.d. If the value of the environment variable ends with the directory separator character, then the default directories are searched after the explic- itly specified directories. For example, setting SANE_CONFIG_DIR to "/tmp/config:" would result in directories "tmp/config", ".", and "/etc/sane.d" being searched (in this order). SANE_DEBUG_GPHOTO2 If the library was compiled with debugging support enabled, this environment variable controls the debug level for this backend. A value of 128 requests maximally copious debug output; smaller levels reduce verbosity. GP_DEBUG Set to 1, 2, or 3, to enable various levels of debugging within the gphoto2 libraries. SEE ALSO
sane(7) AUTHOR
Peter S. Fales The manpage was largely copied from the dc210 manpage. BUGS
Many, no doubt. More general comments, suggestions, and inquiries about frontends or SANE should go to the SANE Developers mailing list (see http://www.sane-project.org/mailing-lists.html for details). You must be subscribed to the list, otherwise your mail won't be sent to the subscribers. 11 Jul 2008 sane-gphoto2(5)
All times are GMT -4. The time now is 04:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy