Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: fubaya
3,879
Posted By fubaya
grep "ALPHANUMERIC.*16"should work as long as...
grep "ALPHANUMERIC.*16"should work as long as there is no other 16 to the right of "ALPHANUMERIC". It will give incorrect output if there is the possibility of a line like:

ALPHANUMERIC 10 BLAH...
8,226
Posted By fubaya
Thanks. After I posted and was "finalizing" the...
Thanks. After I posted and was "finalizing" the script I noticed the missing last letter, which I solved by adding 1 to the length:
LEN=$((${#1} + 1))I also added the quotes out of habit. I didn't...
8,226
Posted By fubaya
Thanks! Actually, the expansion didn't work...
Thanks! Actually, the expansion didn't work correctly when trying offsets but I found a way around with expr substr. All 3 would probably work with a little changing for my particular need, but this...
8,226
Posted By fubaya
insert spaces between characters with pure shell
A file contains: abcdef
I need : a b c d e f

It's easy with sed
sed 's/./& /g'but this is embedded linux that doesn't have sed/awk. The shell is unknown but it's bashlike. Parameter expansion...
5,990
Posted By fubaya
Neither sort will work if you get more than 9...
Neither sort will work if you get more than 9 files unless the single digit numbers have a 0 before their number (01... 09, etc)

(examples)
# touch file{1,2,5,10,15,20}.log
# ls *.log| sort -u |...
1,843
Posted By fubaya
Thanks guys. Just getting around to checking up...
Thanks guys. Just getting around to checking up on this. They both work.

I swear, every time I think I know a little awk, I look at something like this and it looks like Greek. I think I get it,...
1,843
Posted By fubaya
Extract X words from end of line, minus last keynumber X
The file contains one line of text followed by a number. I want to take the number X at the end, take it out and display the last X words. X is the key telling me how many words from the end that I...
2,489
Posted By fubaya
If all account numbers consist of only numbers...
If all account numbers consist of only numbers (no letters) and are 11 digits long and there are no other numbers that are 11 digits long...
grep -E -o -w [0-9]{11} file
1,882
Posted By fubaya
For what it's worth, I think the error in this...
For what it's worth, I think the error in this attempt was simply that tr -d'\n' needs a space after the d.
(my ls -ltr only gives 8 columns so im using awk '{print $8}' )

# ls -ltr *.xls | awk...
5,907
Posted By fubaya
Scrutinizer's is better, but tr -d '\n' is often...
Scrutinizer's is better, but tr -d '\n' is often handy to know.
# ping -c 1 google.com | grep 'PING' | cut -d'(' -f2 | cut -d')' -f1 | tr -d '\n'
74.125.65.104#
1,906
Posted By fubaya
grep: 0652-033 is a "file not found" error. Have...
grep: 0652-033 is a "file not found" error. Have you checked that /sharedapps/etlusr/etl/logs/logftp_mov_03082010061856.log exists? I don't know sql, is it creating the file with it's output? Maybe...
3
4,492
Posted By fubaya
Are you getting an error?
Are you getting an error?
1,408
Posted By fubaya
Can you just check the time the files were last...
Can you just check the time the files were last modified and sound the alarm if they haven't changed in 4 minutes? That should be simpler.

I wanted to see if I could do this with wc -l and basic...
1,988
Posted By fubaya
tr '_' ' ' | egrep -w -o [A-Z]{4}[0-9]{4}Almost...
tr '_' ' ' | egrep -w -o [A-Z]{4}[0-9]{4}Almost one command but I had to use tr first to get rid of the underscore because it's seen as part of the word in the first line. Darn. What it does is grep...
4,791
Posted By fubaya
"$I" is just the filenames so this is actually...
"$I" is just the filenames so this is actually being piped to bc:UL_LAT+/60+/3600which is why reading down the right side of the errors gives you the filenames, minus the A, which it can apparently...
2,076
Posted By fubaya
sed 's/^M$//'Sed is almost the same and you also...
sed 's/^M$//'Sed is almost the same and you also need to type ctrl+v and ctrl+m or it won't work.
2,553
Posted By fubaya
Why not just use "killall runflow"? edit: or...
Why not just use "killall runflow"?

edit: or pgrep
pgrep runflow | xargs kill
4,230
Posted By fubaya
for i in $(ls); do mv $i "3nm${i:10:7}";...
for i in $(ls); do mv $i "3nm${i:10:7}"; done
4,159
Posted By fubaya
You're definitely better off learning the long...
You're definitely better off learning the long way, but here's a shorty...tee file.a.b.{A,B,C,D}.r < file.a.b.c-d.rOr, same thing but slightly longer and easier to understand:
cat file.a.b.c-d.r |...
11,810
Posted By fubaya
That gives me both files, probably because they...
That gives me both files, probably because they both have at least 9 digits. egrep (or grep -E, same thing) is made for this.
# echo 'temp.0000000001.data
temp.000000001.data
temp.000001.data' |...
4,427
Posted By fubaya
I cant test it now but I used this recently and I...
I cant test it now but I used this recently and I don't think >> redirection will work with tee if you want screen output. To append to the file instead of overwriting it, use tee -a.

Overwrite...
1,799
Posted By fubaya
#! /bin/sh unpipe=$(tr '|' ' ' < file2) ...
#! /bin/sh
unpipe=$(tr '|' ' ' < file2)
function foo {
while read line; do echo "${line}${1}"; shift; done < file1
}
foo $unpipe



# ./test
RequestId:1001
RequestDate:2009-03-01
#
4,776
Posted By fubaya
Cant test it right now but this should work: ...
Cant test it right now but this should work:
while read line; do line2=${line// /}; echo ${#line2}; done < file

Edit: heres a test
$ echo "123 45 678 90" | while read line ; do line=${line// /};...
1,850
Posted By fubaya
You can use the grep (or egrep) -B argument to to...
You can use the grep (or egrep) -B argument to to look one line above the search string and only search for <termType>Second". The downside is that you get the "<termType>Second</termType>" line and...
49,926
Posted By fubaya
Whenever I post a script on my blog and include...
Whenever I post a script on my blog and include my email address, I obfuscate it with the tr command to thwart spambots. It could be used here too. If the pass was LinuxRules you could use...
Showing results 1 to 25 of 73

 

Featured Tech Videos

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