Hi,
I get the following response by gphoto2 and I would like to substract the index number of the current item. In this case 3.
By calling
I would like to use this to filter on the 2nd critera as
But I would like to call only by a single line with nested sed commands that the final result looks like
or better only the index 3. But the call have to be robust that I never would get Choice 13 with 2000.
It should only show the line of index 3, so the output would be: ---------- Post updated at 17:51 ---------- Previous update was at 17:49 ----------
If you turn the 2nd grep with an modified awk it could look like this:
In this case we first filter out the Label, Type and current, and then limit the output to index 3, and using awk to just print the value of 200.
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...
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:
Place it in (as example for yourself): $HOME/bin, lets say photo-conf.sh.
Give it execution falg:
And call it:
hth
No user interaction. The gphoto cmd to return iso is calling by node.js for automatic scripting. The filtered result by a nested sed or greb command should return always the integer of the current iso setting.
User will changes the iso on the camera and the automated script monitoring periodically the current iso.
There is a weakness of the call gphoto2 --get-config /main/imgsettings/iso it returns the current value but all the time the enum.
My script calls internally and autom. gphoto2 --get-config /main/imgsettings/iso | sed <nested commands>
to return the index of current iso setting only for further processin.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)