I am trying to write an awk script to convert a CSV formatted spreadsheet into XML for Bugzilla bugs. The format of the input CSV is as follows (created from an XLS spreadsheet and saved as CSV):
tag_1,tag_2,...,tag_N
value1_1,value1_2,...,value1_N
value2_1,value2_2,...,value2_N
valueM_1,valueM_2,...,valueM_N
The header column represe...
I have a script running in the background that prints some output. I redirected the standard output to a file for log purposes. However I don't want this file to grow forever, what would be a good way to do rollover without coding the logic myself? (Either rollover based on date or file size).
...
Possible Duplicates:
Favourite command line trick
useful linux commands for programmers?
What is your single most favorite command-line trick using Bash?
I have recently become accustomed to doing most of my development (in various languages) from the bash shell, using command-line tools and interfaces. I have discovered it ...
I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else.
So I thought I could just do this:
ls | grep \.mp4$ | grep \.mp3$ | grep \.exe$
But no, as the first grep will output just mp4's therefor the other 2 grep's won't be used.
Any ideas?
PS, Running this script on Slow Leopard.
...
How would I get awk to output $9 $10 $11 etc as some of my files have spaces in them.
ls -l | grep ^- | awk '{print $9}'
...
I put original git-completion.bash (from git tarball) and source it from my ~/bash_profile.
When using git branch is shows only HEAD, e.g.:
piotr@PiotrMBP ~/Projects/X (master)
$ git co HEAD
but I have:
$ git br -a
NSXMLDocument
* master
origin/HEAD
origin/NSXMLDocument
origin/master
I haven't modified git-completion.ba...
I just learned that I could use chmod make myscript.sh executable and the run it as $ ./myscript.sh But how can I attach a custom command to it, like $ connectme [options] ?
...
I need to verify if the args are valid file names, is this the right way to do it? It seems like I made some mistake inline 2, but I don't know where.
for i in ${@}; do
if [ -f ${i}]; then
echo ${i}
else continue
fi
done
...
I have a text file like this:
Apple
Orange
Orange
Banana
Banana
Orange
Banana
Orange
Apple
Orange
I want to produce the following output after running a bash shell script:
Apple: 2
Orange: 5
Banana: 3
It's pretty standard stuff if I use a full blown language like Java/C++ etc but what is the quickest way to do it with a shell scrip...
I'm writing a Bash script in which I am running a perl script which requires flags that have double quotes in them. Running the script normally, you would run
$ perl script.pl -flag="something" -anotherflag="somethingelse"
In my script, I'm using variables in these flags, but would like to preserve the doublequotes, so I have somethin...
Hi,
I want to check in a shell script if a local unix-user's passed username and password are correct. What is the easiest way to do this?
Only thing that I found while googling was using 'expect' and 'su' and then checking somehow if the 'su' was successful or not.
...
Hi guys,
For the past few days I have been attempting to write my own shell implementation but I seem to have gotten stuck on getting pipes to work properly. I am able to parse a line and fork off the commands between the pipes (ex: ls | sort) individually but can't seem to get them to pipe input from one into the other.
I think I jus...
First of all, I am well aware of that there are many of questions regarding this topic. I have read them, but still could figure out an appropriate answer for my situation.
I would like to scp the entire ~/cs###/assign1 dir from local to school home dir with a shell script. My question is, is there a way in my script to wait for the pas...
sed 's/\([ab]\)\([ab]\)./\2\1x/g' file.txt
My understanding is:
in file.txt, find any string start with either 'a' or 'b', followed by either an 'a' or a 'b', followed by any ONE char (say 'abc'), and replace it with the string 1st, and 2nd char switched palce, and 3rd char is x ('bax'). Is the syntax of the command correct? and am I c...
How to set a global environment variable in a bash script?
If I do stuff like
#!/bin/bash
FOO=bar
...or
#!/bin/bash
export FOO=bar
...the vars seem to stay in the local context, whereas I'd like to keep using them after the script has finished executing.
...
I use the following two commands to see my tables from binlogs.
mysqlbinlog mysql-bin.000016 | awk '/session/,/;/' | more
mysqlbinlog mysql-bin.000016 | awk '/session_log/,/;/' | more
How do I see both the table lines in a single statement?
...
I have a string, like a sentence, and I know for sure that there are many words with at least one space separate every adjacent two. How can I split the words into individual strings so I can loop through them?
EDIT:
Bash
The string is passed in as an argument. e.g. ${2} might be "cat '' cat '' file". so how can I loop through this ar...
say a string might be like "a b '' c '' d", how can I check that there is single/double quote and space contained in the string?
...
Hi
I want to know how i compile the entire bash shell into my app.I read somewhere that for this i compile its Subroutine. how?
Thanks in advance
...
Is there any way to retrieve the environment variable in 64 bit machine.
I already have %abc% which returns me variable in 32 bit machine, but doesn't work in 64 bit.
My Mistake:
How can I get through command line not through programming language?
...