Hello all,
I have a file that uses the pipe character as a separator since I assumed that most of my clients wouldn't use the pipe character in their data. Apparently I was wrong, but I compensated for this by specifying that any fields using the pipe character need to be wrapped in double quotes. Unfortunately, they haven't done this, ...
In bash, some commands put their stdout BEFORE the command prompt and on the SAME line. For example:
$ printf message
message$
$ gettext -d gtk20 File
Fichier$
I want the stdout on a dedicated line with the command prompt on the NEXT line. I could precede with 'echo' and wrap in back ticks like this, but I wonder if there is a bette...
I have a text file,
!--- Marker one --!
aaaa
bbbb
cccc
dddd
!--- Marker two --!
eeee
ffff
!--- Marker three --!
gggg
hhhh
iiii
And I need to copy from Marker two (till the end of Marker two) into a new file, using Bash.
!--- Marker two --!
eeee
ffff
Becomes a separate file.
...
I have lines of data that contain
single column and two columns. What I want to do is to
extract lines that contain only 2 columns.
0333 foo
bar
23243 qux
yielding only:
0333 foo
23243 qux
Note that they are tab separated, even for lines with only one column
you have tab at the beginning.
What's the way to do it?
I tried this...
Hi,
I ssh to another server and run a shell script like this nohup ./script.sh 1>/dev/null 2>&1 &
Then type exit to exit from the server. However it just hangs. The server is Solaris.
How can I exit properly without hanging??
Thanks.
...
In shell scripting how to find factorial of a number?
...
Hello,
I have a sh/bash script that needs to call a batch file with parameters (parameters are file names and are given in DOS/Windows format).
Basically I have:
script.sh
#!/bin/sh
declare var1=$1
declare var2=$2
dosomething var1 var2
...
<invoke batch script> var1 var2
...
dosomethingelse
I'm using GNU bash, version 3.1.0(3)-releas...
Hi all,
I'm going nuts with this...let me explain...
I have a very simple Bash script with a function in it that receives 3 arguments. Those arguments are all strings. Everything was working fine 'til I had to pass a string with whitespaces to the function.
I also have some test code to call the function (whose name is substracFromF...
I'm trying pipe the output of an awk command through more than one command at once in a Bash shell, following my knowledge I'm coming up with this:
awk '$13 ~ /type/ {print $15}' filename.txt | (wc -l || sort -u)
I want the result of the awk command to be both counted AND sorted, how can I accomplish that?
Even with && command it does...
Does anybody know of an implementation of POSIX shell like language for scripting things in Java?
If this is not available, does anybody know if there is a ANTLR or JavaCC grammar available somewhere which I might have missed?
edit:
I know that I have Jython, JRuby, Groovy, JavaScript available for scripting, but none of them have ba...
I'm trying to find files modified recently with this
find . -mtime 0
Which gives me
en/content/file.xml
es/file.php
en/file.php.swp
css/main.css
js/main.js
But I'd like to filter out the en and es directories but would like to grab anything else. In addition, I'd like to filter out .swp files from the results of those.
So I want t...
I have asked how to make any command "ask for yes/no before executing" in the question
http://stackoverflow.com/questions/3231804/in-bash-how-to-add-are-you-sure-y-n-to-any-command-or-alias
It seems like for the command
hg push ssh://[email protected]//somepath/morepath
I can also do this:
echo ssh://[email protected]...
I'm working with a bash script that is currently working on a server (RHEL4). I'm developing on my laptop with Ubuntu 10.04, but I don't think the platform is causing the problem.
Here's what's happening:
I have a skeleton script that calls another script that does most of the work. However, it makes calls to getConfig.sh a lot. getConf...
Let's say you have the following.
192.168.0.100
192.168.0.100
192.168.0.100
192.168.0.102
192.168.0.102
192.168.0.100
That's considered 3 unique hits. The way to distinguish it is that consecutive identical IPs count as one. How would you loop through the file and count accordingly?
...
I use two Internet connections so i want to use bash scripts to automate the task of switching between the two..
the problem is i cant able to configure firefox proxy settings via scripts, so is there a way to do that... does any configuration file exists for firefox so that i can modify over command line..
I have read this entry but th...
I have a command called youtube-dl .. but dont know where it is installed.. i can run it from shell.. how do i find where it is installed ? which youtube-dl doesnt say anything..
...
Hi All,
I want to get the total count of the number of lines from all the files returned by the following command:
shell> find . -name *.info
All the .info files are nested in sub-directories so I can't simply do:
shell> wc -l *.info
Am sure this should be in any bash users repertoire, but am stuck!
Thanks
...
I'm trying to write a cron job that runs a report, and emails the result to an address defined in my user's ~/.bashrc file. I had this working perfectly on Fedora, but when I switched to Ubuntu, my solution no longer works. The command my cron job currently runs is:
. /home/myuser/.bashrc; /home/myuser/bin/runreport
If I run that comm...
I am creating a bash script to backup my files with rsync.
Backups all come from a single directory.
I only want new or modified files to be backed up.
Currently, I am telling rsync to backup the dir, and to check the files compared to the last backup.
The way I am doing this is
THE_TIME=`date "+%Y-%m-%dT%H:%M:%S"`
rsync -aP --link...
Some time ago, i wrote some bash scripts for my school. I thought it would be very clever to 'protect' them, so i compiled them with shc into a binary file. Some weeks later, i lost the uncompiled scripts and now i have only my binarys left.
Is there a way to retrieve the scripts back from the shc generated binarys? I looked into the so...