Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: Rhije
5,383
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!
24,493
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,383
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...
3,840
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...
1,866
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,383
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...
1,782
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...
23,203
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,678
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,089
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...
4,833
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
15,442
Posted By Rhije
Sorry!
Sorry!
15,442
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,534
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,634
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...
1,970
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?
4,917
Posted By Rhije
No problem!
No problem!
4,917
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...
25,045
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
3,129
Posted By Rhije
Well, you can also just do: awk '$3 ~...
Well, you can also just do:


awk '$3 ~ /0000001234/' file
21,648
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.

...
3,129
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...
22,862
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
22,862
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,391
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

 

Featured Tech Videos

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