Search Results

Search: Posts Made By: Rhije
5,733
Posted By Rhije
radoulov - Thank you very very much, that worked...
radoulov - Thank you very very much, that worked perfectly! Now I need to go study more bash!
27,643
Posted By Rhije
It depends on if it is going to be on lines by...
It depends on if it is going to be on lines by itself, or if it is going to be its own word, such as "rat" inside of "berate". Word boundaries would probably work (those are the \b escapes in the...
5,733
Posted By Rhije
Doesn't matter what code you use as long as it...
Doesn't matter what code you use as long as it wants an arg/param, and doesnt matter what you parse to it, for instance:


#!/usr/bin/bash

testFile=$1

if [[ -z "$testFile" ]]
then
echo...
4,164
Posted By Rhije
I tested array assignment and checking the values...
I tested array assignment and checking the values of the variables and arrays and did not have any issues with the brackets. Are you doing something differently then what is shown below, or are you...
3,508
Posted By Rhije
I am really not sure what you are asking. Could...
I am really not sure what you are asking. Could you provide a bit more detail, such as a few lines from the current file (or mock ups), and what you want them to look like ?
5,733
Posted By Rhije
Using GET, passing argument to bash
Hi guys!

So, I use GET ( Simple user agent using LWP library. ) on a remote text file that is then passed to bash and executed. However, I need to pass that bash script a single argument, and so...
2,028
Posted By Rhije
Well, the output format you will need to work on...
Well, the output format you will need to work on (it wont take much more then what you currently have), to find .csv and .dat files, that wouldn't be too hard.


find . -type f | egrep -i...
33,050
Posted By Rhije
You can just echo the date and append it to a...
You can just echo the date and append it to a file, if the file does not exist, then it is created.


-bash-3.2$ echo `date` >> dates.txt
-bash-3.2$ echo `date -d '+1 days'` >> dates.txt...
1,963
Posted By Rhije
The IFS (input field separator) is set to...
The IFS (input field separator) is set to whitespace characters by default (space, tab, newline). If you use the 'while read' combination, you can assign each line to a variable (basically just like...
13,888
Posted By Rhije
Grep regex matches, groups
Hello,

I am searching all over the place for this, just not finding anything solid :(

I want to do be able to access the groups that are matched with grep (either with extended regex, or perl...
6,497
Posted By Rhije
You can also use the '-o' flag for grep and then...
You can also use the '-o' flag for grep and then pipe it to wc


-bash-3.2$ echo "abs|der|gt|dftnrk|dtre" | grep -o "|" | wc -l
4
16,186
Posted By Rhije
Sorry!
Sorry!
16,186
Posted By Rhije
panyam - We do not really need much more...
panyam - We do not really need much more information then what he provided. Create test data and mess with it.

Priya - You can use sed, which is probably a bit easier. You have to use the -n...
2
Sed
1,723
Posted By Rhije
You can use the 'extended regular expressions',...
You can use the 'extended regular expressions', although it may not be necessary. You do not need to put what you are trying to find in double quotes either. For the regex, put the characters in...
1,807
Posted By Rhije
sed is a Stream-line EDitor (see what I did...
sed is a Stream-line EDitor (see what I did there?).

Anyways, you do not esc + :wq or anything like in vim. You would either do in place editing


sed -i 'something here' file


Or you...
2,138
Posted By Rhije
I have never had the error, hrm. If the data...
I have never had the error, hrm. If the data that you are working with is not too long, could you show me a sample so I can test it?
7,009
Posted By Rhije
No problem!
No problem!
7,009
Posted By Rhije
Oh thats an easy one. There is also 'bc' but...
Oh thats an easy one. There is also 'bc' but that would be for really hard core math, and then there is "let".. but dont worry with those.. you can just use awk.


-bash-3.2$ cat test.txt
one 1...
29,398
Posted By Rhije
Well, you can loop over them. -bash-3.2$...
Well, you can loop over them.


-bash-3.2$ cat test.txt
aaa_bbb_ccc_ddd.abc

-bash-3.2$ awk -F"[_.]" '{ for (i = 1; i<=NF;i++) { print $(i); } }' test.txt
aaa
bbb
ccc
ddd
abc
5,221
Posted By Rhije
Well, you can also just do: awk '$3 ~...
Well, you can also just do:


awk '$3 ~ /0000001234/' file
22,376
Posted By Rhije
haha, sorry but this is not an issue. I copied...
haha, sorry but this is not an issue. I copied and pasted exactly what you had in file1 and ran the same tests and came up with the same results. I also did a stat on it and it IS 109 bytes.

...
5,221
Posted By Rhije
grep is going to be working on a line by line...
grep is going to be working on a line by line basis, so grep ^09 is doing just what you asked it to do by finding any line that begins with 09

You probably want to use awk, it would be the easiest...
23,381
Posted By Rhije
Candlejack - whoops.. just realized someone...
Candlejack - whoops.. just realized someone before us had updated it for no reason at all.. and I didn't check time. hah, its alright, we both fail :P
23,381
Posted By Rhije
You can't find it? Did you possibly delete the...
You can't find it? Did you possibly delete the man pages from the system? Or just that one?


%CPU -- CPU usage
The taskâs share of the elapsed CPU time since the last screen update,...
6,985
Posted By Rhije
awk -v num=$n '{ $(NF+1) = num; print }' "$file"...
awk -v num=$n '{ $(NF+1) = num; print }' "$file" > "$file.new"
n=$(( $n + 1 ))


So, the -v num=$n is making awk set the variable "num" to the value of $n (originally set to 1 before the loop). ...
Showing results 1 to 25 of 98

 
All times are GMT -4. The time now is 02:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy