I can't get around this for quite sometime now. As I read along manuals and tutorials I'm getting more confused. I want an if statement with the following logic:
if [ -n $drupal_version ] && [[ "$drupal_version" =~ DRUPAL-[6-9]-[1-9][1-9] ]]; then
but I can't get it to work properly.
When the script is evaluated using the "bash -x .....
Hey,
Using only grep and sed, is there a way I can tranform the output of ls -l * into this :
-rw-r--r-- agenda.txt
-rw-r--r-- annuaire.txt
Thanks!
...
Hi,
I have a huge text file with lines like:
-568.563626 159 33 -1109.660591 -1231.295129 4.381508
-541.181308 159 28 -1019.279615 -1059.115975 4.632301
-535.370812 155 29 -1033.071786 -1152.907805 4.420473
-533.547101 157 28 -1046.218277 -1063.389677 4.423696
What I want is to sort the file, depending on the ...
Hi,
this is probably a very stupid question; in a bash script, given the output of, for instance;
awk '{print $7}' temp
it gives 0.54546
I would like to give this to a variable, so I tried:
read ENE <<< $(awk '{print $7}' temp)
but I get
Syntax error: redirection unexpected
Could you tell me why, and what is the easiest way t...
Hi,
I am trying to find some float number (like -1234.5678) in a huge text file using grep, so I thought about:
grep -n '-1234.5678'
but I get errors, do you know what is the right way using grep and why? there is anything easier?
Thanks
...
Hi,
I have a huge text file with lots of lines like:
asdasdasdaasdasd_DATA_3424223423423423
gsgsdgsgs_DATA_6846343636
.....
I would like to do, for each line, to substitute from DATA_ .. to the end, with just empty space so I would get:
asdasdasdaasdasd_DATA_
gsgsdgsgs_DATA_
.....
I know that you can do something similar with:
...
I recently inherited a Ubuntu Hardy box that acts rather funky out-of-the-box. The first things I tried to do was edit my .bashrc profile to do some coloring and add some aliases I usually have, but then when I try to source the ~/.bashrc I get sh: source: not found and I have also noticed tabbed autocomplete is also not working at all -...
Hi,
I have a huge text file with lots of lines like:
a 23232 23232 545 3434 DATA4545454_1 454 4646466 3434 3567
a 23232 23267632 545 3436764 DATA454545567564__1 454 464675466 3434 3
a 232676732 232676732 545 3434 DATA4545454_1 454 46457566466 3457534 35675
In all of them I would like to get rid of everything which is after DATA*, so ...
Hi,
I have a huge text file, which follows the structure:
SET
TAG1
...
...
SET
...
SET
TAG2
...
...
SET
...
...
I would like to extract for a specific TAG, (i.e. TAG54) its individual "substructure", which would be
SET
TAG54
...
...
SET
Each substructure, for a given TAG_i contains always:
first line:SET
second line:TAG_i (in thi...
I feel like I often name files in such a way that my computer constantly beeps while I program because the tab completion is ambiguous. Before doing a lot of Unix programming, I tended to name related files with the same prefix to indicate their relation. Now I must re-think my approach to folder and file structures and names to program ...
Hey, not 100% sure what this error means.
% for f in "*" ; do cp $f ../backup/backup$f ; done
cp: ../backup/backup* not found
The purpose is to copy all the files into a folder into a backup folder and rename the files to backup.
...
I'm trying to write a script that searches a directory for files and greps for a pattern. Something similar to the below except the find expression is much more complicated (excludes particular directories and files).
#!/bin/bash
if [ -d "${!#}" ]
then
path=${!#}
else
path="."
fi
find $path -print0 | xargs -0 grep "$@"
Obviou...
My deploy.rb sets some environment variables to use the regular user's local Ruby rather than the system-wide one.
set :default_environment, {
:PATH => '/home/myapp/.rvm/bin:/home/myapp/.rvm/bin:/home/myapp/.rvm/rubies/ruby-1.9.1-p378/bin:/home/myapp/.rvm/gems/ruby-1.9.1-p378/bin:/home/myapp/.rvm/gems/ruby-1.9.1-p378%global/bin:/home/...
In bash, when I go back in history, edit some command and run it, this edited command is appended to history and the original one is left intact. But every once in a while I somehow manage to affect the original command, i.e. my edit replaces the original command back in history. I can't put my finger on how this happens. Can someone exp...
Hello! I am attempting to automate moving files from a folder to a new folder automatically every night using a bash script run from applescript on a schedule. I am attempting to write a bash script on Mac OSX, and it keeps failing. In short this is what I have (all my ECHOs are for error checking):
#!/bin/bash
folder = "ABC"
useracct...
Simply, I'm just looking to get a list of connected remote disks.
I have a script right now that compares /Volumes/ to "diskutil -list" but that only gives me the name of the remote disks, not the actual address.
Anyone have ideas as to how I might go about doing this?
Thanks in advance.
...
My input file content is
welcome
welcome1
welcome2
My script is
for groupline in `cat file`
do
echo $groupline;
done
I got the following output.
welcome
welcome1
welcome2
Why it is not print the empty line. I want the reason.
...
I made this bash one-liner which I use to list Weblogic instances running along with their full paths.This works well when I run it from the shell.
/usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print $2}' | sed 's/weblogic.policy//' | sed 's/security\///' | sort
I tried to incorpora...
I do this in a script:
read direc <<< $(basename `pwd`)
and I get:
Syntax error: redirection unexpected
in an ubuntu machine
/bin/bash --version
GNU bash, version 4.0.33(1)-release (x86_64-pc-linux-gnu)
while I do not get this error in another suse machine:
/bin/bash --version
GNU bash, version 3.2.39(1)-release (x86_64-suse-li...
Hi,
I get in a bash script, in the follwoing line
echo $AAAA" "$DDDD" "$MOL_TAG >> ${OUPUT_RESULTS}
the error:
line 46: ${OUPUT_RESULTS}: ambiguous redirect
Why?
Thanks
...