Programming :: PHP Outputs Metadata Or File Information At The Top Of Its Output
Sep 10, 2010Consider this PHP Script or just skip to the Output:
Code
Code:
-bash-2.05b# cat myDate.php
#!/usr/bin/php -q
<?php
[code]....
Consider this PHP Script or just skip to the Output:
Code
Code:
-bash-2.05b# cat myDate.php
#!/usr/bin/php -q
<?php
[code]....
I have a requirement like this:Cut the characters from each line of a file with following positions: 21-24, 25-34 ,111-120.Thse fields now need to be placed in a tab delimited output file.Currently this is how I am achieving it:
#!/bin/sh
cat newsmaple.txt | cut -c 21-24 > out1.txt
cat newsmaple.txt | cut -c 25-34 >out2.txt
[code]....
I want to grab information from mediainfo and output it to a file with text already in it.
How would I do that?
Code:
#declaring the variables
filename=$1
DATE=`mediainfo "$filename" | grep "Recorded date" | awk -F" : " '{ print $2 }' | tr -d '
[Code].....
Php file that basically runs a few commands and echoes the output. It's for checking things like temperatures etc, space free.
You can see it in action here: [url]
I've attached the actual php file.
Two questions:
1) What more can I add to it to give me even more information?
2) I want to add hddtemp but it requires sudo to run. How can I get around this?
I want to make a program that edits music file ID3 tags, for example: overwrites all "artist" tags for a list of files with other one. I know some c++,python and shell scripting.
- how can I get just the metadata from a mp3 file? Mplayer shows file metadata before playback, but I could not find a switch for mplayer that displays just the data
- how can I edit the metadata?
- What libraries should I check out if I want to implement this with C++ or python?
- What about "custom" metadata tags? In the foobar2000 media player for m$ i could make my own metadata tags (like "record label"). How can these be edited & added?
My script.
This is may script:
Code:
Problem: Output file doest not exclude the values in grep -av
My employer issues pdf files with everyones work schedules. I copy the content and save it as plain text in a file called unformatted (hope to be able to automate this step someday). Im working on a SED script that reduces unformatted to only display what I want to see and saves the result in a file Iïve named formatted. After that I have to manually copy formatted and save it with that days date as a filename e.g. 2011-02-25 or whatever day is scheduled in the pdf, for use on a mobile device (Nokia N900). I noticed that the date occurs on certain lines in the file so I added a line like:
sed -n 's/^Date: (201[1-9])/([0-1][0-9])/([0-3][0-9]).*/1-2-3/p' < unformatted >theDate
That creates a file theDate with the date in it that I wish to use as the filename for this particular instance. So I would like to skip the file formatted all together and have the sed- script write to a new file using the content of the Date as a filename, but how do I make that happen? And of course it would be more elegant if I could skip the intermediate theDate file as well.
I've been able to get the right output that I need from sed, but how can I execute the string that sed actually outputs?
View 3 Replies View RelatedI want to catch some outputs in two different log files in bash, file simple.log and all.log So far, the script is started like this:
Code:
xterm -e "(./myscript.sh | tee -a simple.log) >& all.log"
What I want is:
- In simple.log, I want all the stdout but WITHOUT errors.
- In all.log I want BOTH stdout and stderr.
So all is ok, and the output becomes:
all.log
Code:
starting copying files
mv: cannot move ... : permission denied
copying completed
simple log
Code:
starting copying files
copying completed
But, in the new xterm, I'm loosing stdout. There is no output.How can I have the files logged as they are but also have the stdout in the xterm.
I would like to make a one-liner, which diff's "ps aux" output before and after killing a process. So basically it should be a combination of fallowing commands:
1) diff -u
2) ps aux | awk '{print $2}'
3) kill `ps aux | grep [c]ron | awk '{print $2}'`
4) ps aux | awk '{print $2}'
How to achieve this? Something like this:
Code:
diff $( kill `ps aux | grep [c]ron | awk '{print $2}'` && ps aux | awk '{print $2}' ) $( ps aux | awk '{print $2}' )
I don't have pgrep or pkill available.
have a file (called it A) contains;
hostname 192.168.23.65
hostname 10.18.13.253
hostname 10.18.16.253
[code]...
I would like to compare two md5sum outputs to see if the files match. in my script I have
Code:
ORG_FILE="/path/to/org/file.zip"
NEW_FILE="path/to/new/file.zip"
MD5_ORIG=$(md5sum -b "$ORG_FILE")
[code]....
How do I get just the MD5 hash and not the */.... stuff so I can compare them. i tried Code: JUST_HASH=${$MD5_ORIG:0:32} but All I get is
dir_mon_notify.sh: line 79: ${$MD5_ORIG:0:32}: bad substitution
I am again struggling to make a script work, but hey, it is fun, I am learning new things. I discovered the set -x option which was, for me, like the second coming. Still, what I am not able to do is redirect ALL output to a (log) file, including what is produced by the -x setting. Let's assume a very simple script:
Code: #!/bin/bash
set -x
source="/home/atelier/Bureau/"
ls -la $source and I am running it as . test.sh >> /var/log/test.rmcb.log
The result of ls goes inded into the log file, but the rest still shows on the console where I am running the script: Code: ++ source=/home/atelier/Bureau/
++ ls --color=auto -la /home/atelier/Bureau/ Is there a way to redirect EVERYTHING to the log file ?
I want to pipe the output of ls in a folder to a file (lets call it test.txt) but when i do so, but when i do ls > test.txt in test.txt there is also test.txt (logical
View 4 Replies View RelatedI have a directory that has about 5,000+ folders in it and I'd like to run a script that outputs any directory that contains a subdirectory.
View 4 Replies View RelatedCode:
I'm trying to make several files: each named after the display and containing resolutions. But for some reason I get null when trying to read lines.
i have wrote a long piece of code above with the "main" which is calling openFile( &fout, filename )filename contains the txt name in a form of "data.txt"i wanna read the data from the file and output it into fout for later use.the data in that file is a vector looking interger group.i have the following code:
int openFile( ofstream * fout, const char * filename)
{
ifstream iFile(filename);
[code]...
I am learning Linux daemon programming and write a simple daemon program. The issue is no data is written to the log file (/var/tmp/simpledeamon.log) though the file is successfully created (it's file size is zero from ls -l output). Could someone kindly point out the error in my program,The code is based on the Devin Watson's article at Here is the code:
// simplydaemon.cpp
// A simple Linux daemon.
#include <sys/types.h>
[code]...
I'm writing output of top command to a file However since top does not provide time I would like to append the 'date' command and then write all this to a file.
so something like top -d 1 -b; echo 'date' >>file
I have got a script with an outer and inner loop. The inner loop issues loads of echo's which need to be redirected to a log file determined by the outer loop. The obvious solution is to redirect every echo to >$LOG and set LOG in the outer loop.
Code:
for f in $FILES ; do
LOG=<logfile>
for l in $LINES ; do
[code]....
it is possible to map stdout to $LOG in the outer loop without having to redirect every subsequent individual command output?
I did a select on my db and now I need that this if consult return true for me salve the columns information in file. How I do this in Shell?!
View 3 Replies View Relatedhow to update a series of values from multiple grep commands outputs to be appended to a single row of a csv file? Work on a linux envir. The values from grep output will be numeric values.
Output sold look like:
1,3,4,5,7,0,5
Each of these values will be odtained from multiple grep commands piped with wc -l Is it possible to update a single row of a csv file if so pleas ehelp me with the command to be used to redirect the output into the csv file
I have a problem when using awk:
e.g: awk '{processing text}' File1 > File2
But when I'm processing the File1, I want to print out some messages to the screen (not the File2). How can I do that?
The perl script I wrote works fine if I print the result to screen
x0_amber.pl 1 1000 0 5
But whenever I want to output to a file with
x0_amber.pl 1 1000 0 5 > x0_out
it never really prints out to the file.
It worked earlier, but I was playing with my PATH lately, I don't know if it's related to that
Within PyGTK I'm using gobject.spawn_async to launch a bash script. I would like the output of that bash script to be displayed within my application. I have a textview set up to receive the text ...
Here are the commands that launch the program:
Code:
def run_command(command):
global keep_pulsing
keep_pulsing=True
(cpid, cstdin, cstdout, cstderr) = gobject.spawn_async(command,flags=gobject.SPAWN_DO_NOT_REAP_CHILD|gobject.SPAWN_STDERR_TO_DEV_NULL,standard_code....
Here are the two callback functions. But like I say ... I have no idea how to get that data from the 'cstdout' file descriptor into a textbuffer.
Code:
### THE FOLLOWING ARE GLOBALS:
textview = wTree.get_widget('textview1')
textbuffer=textview.get_buffer()
def update_textview_callback(fd, condition):
global keep_pulsing
if keep_pulsing:
progressbar.pulse()
code....
I'm on Ubuntu 11.04. I have read around about how to use curl to download a list of URLs from a text file, and everyone says to use
Code:
curl -K URLlist.txt This is what the curl man page says as well. However, for even a simple file with one URL, this command outputs a bunch of weird symbols for me instead of downloading the file. For example, I have a text file "test.txt" with one line in the following format:
Code:
url = "http://www.example.com/image.jpg" I use the curl command to download this file:
[Code]...
I'm on Ubuntu 11.04. I have read around about how to use curl to download a list of URLs from a text file, and everyone says to use Code:curl -K URLlist.txt. This is what the curl man page says as well. However, for even a simple file with one URL, this command outputs a bunch of weird symbols for me instead of downloading the file.For example, I have a text file "test.txt" with one line in the following format:
Code:
url = "http://www.example.com/image.jpg"
I use the curl command to download this file:
[code]....
In linux we can make it output bootstrap instructions,
what about windows?
Consider the two runs of finger command for two different users:
Code:
[root@localhost ~]# finger root
Login: root Name: root
[code]...
Is it possible to make a script that makes a tree of all folders and subfolders and outputs it to either a .txt file or .pdf? All folders except from one shall list 2 levels. The except folder all the way.
View 3 Replies View Related