Exiftool shortens string output - exiftool

I am trying to get a string output using Exiftool. The original value should be:
1.00000095367432 -0.00040300001273863 -0.000503999995999038 0.000391999987186864 0.9999960064888 0.00425100000575185 -0.00258799991570413 -0.00425100000575185 0.999997973442078
But when I run the command:
exiftool -a -u -TAG image.jpg
Exiftool shortens the output. It returns:
1.00000095367432 -0.00040300001273863 -0.00050399999599[...]
How can I get the entire string value?

To get the full output, try disabling printConv. You can do this for all tags with the -n option but if you are extracting other tags at the same time, you can use the per tag option by adding # to the end of the tag name e.g exiftool -u -a -Manufacturer0x7121# .

Related

replace capture match with capture group in bash GNU sed

I've looked around to find a solution to my problem in other posts listed bellow, but it looks my regex is quit different and need special care:
How to output only captured groups with sed
Replace one capture group with another with GNU sed (macOS) 4.4
sed replace line with capture groups
I'm trying to replace a regex match group in big JSON file,
My file has mongoDB exported objects, and I'm trying to replace the objectId with the string:
{"_id":{"$oid":"56cad2ce0481320c111d2313"},"recordId":{"$oid":"56cad2ce0481320c111d2313"}}
So the output in the original file should look like this:
{"_id":"56cad2ce0481320c111d2313","recordId":"56cad2ce0481320c111d2313"}
That's the command I run in the shell:
sed -i 's/(?:{"\$oid":)("\w+")}/\$1/g' data.json
I get no error, but the file remains the same.
What exactly am I doing wrong?
Finally I've managed to make it work, the way regex works in bash is different then in regexr.com tester tool.
echo '{"$oid":"56cad2ce0481320c111d2313"}' | sed 's/{"$oid":\("\w*"\)}/\1/g'
gives the correct output:
"56cad2ce0481320c111d2313"
I found it even better to read from stdin and output to file, instead of writing first to JSON file, then read, replace and write again.
Since I use mongoexport to export collection, replace the objectId and write the output to JSON file, my final solution looks like this:
mongoexport --host localhost --db myDB --collection my_collection | sed 's/{"$oid":\\("\\w*"\\)}/\\1/g' >> data.json

In P4 command line I only need to get the Description and Files fields

Using CMD why this does not work ?
p4 --field Description="New CL description here" change -o changelist_number | p4 change -i
P4 change -o gives me the list of files and an empty description field. What is the best cmd batch command to change the description ? Considering I don't want to replace < enter the description here > with a string finder.
To change the description of a pending changelist, do:
p4 --field "Description=NEW DESCRIPTION" change -o CHANGE | p4 change -i
Note that you need an up to date p4 client executable (for the --field flag) and that this won't work on a submitted changelist since they're protected from editing.
This approach works for single line description but not multi-line description. Suppose I have a variable $desc that contains multiple lines, how will I use it with above command, since this is not working:
p4 --field "Description=$desc" change -o CHANGE | p4 change -i

Setting file modification date from exif date

To set the file modification date of images to the exif date, I tried the following:
exiftool '-FileModifyDate<DateTimeOriginal' image.jpg
But this gives me an error about SetFileTime.
So maybe exiftool cannot do it in linux.
Can I combine
exiftool -m -p '$FileName - $DateTimeOriginal' -if '$DateTimeOriginal' -DateTimeOriginal -s -S -ext jpg . with "touch --date ..."?
See this Exiftool Forum post.
The command used there is (take note of the use of backticks, not single quotes):
touch -t `exiftool -s -s -s -d "%Y%m%d%H%M.%S" -DateTimeOriginal TEST.JPG` TEST.JPG
But I'm curious about your error. Exiftool should be able to set the FileModifyDate on Linux (though FileCreateDate is a different story). What version of Exiftool are you using (exiftool -ver to check)?
Another possibility is that the DateTimeOriginal tag is malformed or doesn't have the full date/time info in it.
FWIW, StarGeek's answer was a great pointer in the right direction, but it did not work for me: many of my photos were reported to have "Invalid EXIF text encoding" (no obvious difference compared to those that were "fine"), even though exiftool somefile.jpg would clearly output a valid "Modify Date".
So this is what I did:
for i in *.jpg ; do d=`exiftool $i | grep Modify | sed 's/.*: //g'` ; echo "$i : $d" ; done
...to produce output like this:
CAM00786.jpg : 2013:11:19 18:47:27
CAM00787.jpg : 2013:11:25 08:46:08
CAM00788.jpg : 2013:11:25 08:46:19
...
It was enough for me to output the timestamps next to the file names, but given a little bit of date-time formatting, it could easily be used to "touch" the files to modify their filesystem timestamps.

Finding a date from string using shell script?

How can I find a date inside a string using shell script?
For example, I have this string "/foo/bar/mxm-20140908.txt"
and the out put should be 20140908, thanks!
You can use egrep with the -o option. One where it uses a - separator (as per the original question):
pax> echo /foo/bar/mxm-2014-09-08.txt | egrep -o '[0-9]{4}(-[0-9]{2}){2}'
2014-09-08
Or, with no separator (as per the changes made):
pax> echo /foo/bar/mxm-20140908.txt | egrep -o '[0-9]{8}'
20140908
Just have to be careful in that latter case if the eight digits may show up somewhere in a non-date context.

How to cut file name in grep output (awk, sed)?

Hello I have an output from grep
cc.log.1:<Operation adaptorMethod="search" adaptorName="Search" status="Success"/>
cc.log.12:<Operation adaptorMethod="getOrderId" adaptorName="PersistenceAdaptor" status="Success"/>
I need to cut off file name from beginning and leave only tag
I tried several variants of awk '/<Operation/,/>$/' sed -n '/^<Ope/,/>$/p' and etc
But have no success. Could anyone help me?
You don't need sed, awk or cut you just want the -h option of grep:
-h, --no-filename
Suppress the prefixing of file names on output. This is the default when
there is only one file (or only standard input) to search.