[solved]Grep usage
So if I'm reading the man pages right if I run something like 'grep -f awesome' It'll search the whole filesystem for any file with 'awesome'
Last edited by jedijimi (2014-03-23 19:19:49)
No.
-f FILE, --file=FILE
Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing. (-f is specified by POSIX.)
The -f option is for when you have a file containing the patterns you wish to match against...
$ grep alias .bashrc
# Source ~/.bash_aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
$ echo alias > patterns
$ grep -f patterns .bashrc
# Source ~/.bash_aliases
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
Similar Messages
-
[Solved] cpu usage 100%, it is bug of lxpanel
My archlinux is on an old PIII machine. Recently, I found its CPU usage is 100%.
But, I don't know how to solve it. I can not found out which is cpu eater.
vmstat is 0 idle, but on top view, there are a few process with lower cpu usage.
I've tried both kernel, both cause 100% cpu usage.
kernel26 2.6.37.5-1
kernel26-lts 2.6.32.36-1
# vmstat 2 10
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 103060 26496 227192 0 0 52 38 202 425 56 41 1 3
4 0 0 103300 26496 227196 0 0 0 0 192 439 54 47 0 0
1 0 0 103300 26496 227196 0 0 0 0 303 589 64 36 0 0
1 0 0 103316 26496 227196 0 0 0 0 367 656 64 37 0 0
# top - 22:37:53 up 52 min, 2 users, load average: 2.46, 1.87, 1.80
Tasks: 81 total, 2 running, 79 sleeping, 0 stopped, 0 zombie
Cpu(s): 57.9%us, 41.1%sy, 0.0%ni, 0.0%id, 0.0%wa, 1.0%hi, 0.0%si, 0.0%st
Mem: 495416k total, 385172k used, 110244k free, 25784k buffers
Swap: 0k total, 0k used, 0k free, 224916k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1152 root 20 0 70992 20m 5976 S 14.5 4.2 1:13.63 X
23680 dlin 20 0 109m 22m 13m S 7.2 4.6 1:43.47 chromium
1887 dlin 20 0 138m 12m 9848 S 6.9 2.6 0:12.89 lxterminal
1182 dlin 20 0 99848 11m 8904 S 3.9 2.3 2:42.20 lxpanel
1191 dlin 20 0 297m 43m 27m S 1.0 9.1 1:00.54 chromium
21399 dlin 20 0 4404 1144 888 R 0.7 0.2 0:00.02 menu-cache-gen
1 root 20 0 1712 608 548 S 0.3 0.1 0:17.09 init
4 root 20 0 0 0 0 S 0.3 0.0 0:02.20 ksoftirqd/0
419 root 20 0 0 0 0 D 0.3 0.0 0:02.82 usb-storage
1161 root 20 0 3648 1144 988 S 0.3 0.2 0:00.65 hald-addon-stor
Last edited by dlin (2011-04-02 16:38:08)It seems that the problem occurs to me too! Could it be linked with libreoffice?
I think I have permission in ~/.cache directory:
ls -lh |grep .cache
drwxr-xr-x 2 manu manu 4,0K 29 mars 2010 cache
[11:21][manu@compal:~]$ ls -lh .cache
total 36K
drwx------ 2 manu manu 4,0K 19 oct. 15:56 dconf
-rw-r--r-- 1 manu manu 12K 14 mars 11:52 event-sound-cache.tdb.12c7aa4c6ede9c34246c65044a475d7e.i686-pc-linux-gnu
drwxr-xr-x 3 manu manu 4,0K 18 août 2010 geeqie
drwx------ 3 manu manu 4,0K 22 sept. 2010 gegl-0.1
drwxr-xr-x 2 manu manu 4,0K 12 sept. 2010 gogglesmm
drwx------ 2 manu manu 4,0K 1 avril 19:49 menus
drwx------ 3 manu manu 4,0K 11 déc. 18:42 vlc
[11:21][manu@compal:~]$ ls -lh .cache/menus
total 80K
-rw------- 1 manu manu 38K 23 nov. 19:24 26a80813bb7494e1d982502af748aef6
-rw------- 1 manu manu 38K 1 avril 19:49 757379b1865bb943a0541b554ffbb809
lxpanel is linked with .cache/menus directory?
I will try to delete .cache and see what happens!! -
[SOLVED] modprobe usage info displayed at boot
This thread seems related to /sbin/modprobe runs at boot before udev [solved]
I'm using mkinitcpio 0.7.2-1 on x86_64, my system is completely up-to-date, but somehow I seem to be still affected by FS#24766: I'm getting modprobe's usage info displayed at boot.
My MODULES array in /etc/mkinitcpio.conf is empty and the file is unmodified.
I have tried reinstalling mkinitcpio with no positive results.
Any ideas? Thanks
Last edited by kynikos (2011-07-31 18:59:41)Eheh, it worked, thanks! I wonder why reinstalling mkinitcpio didn't solve it then... well, nevermind
-
[SOLVED] Example usage of pyalpm library
Hİ,
I am trying to find my way around pyalpm library, but I couldn't be able to do much yet. So far, I have been able to get local database and sync databases but I couldn't be able to refresh databases, install/remove a new package etc.
And also, it would be nice if someone explained to me the work flow of pyalpm, because so far I couldn't be able to fully understand what does exactly what.
Thanks in advance
Yaşar Arabacı
Edit: I guess I just figured out everyday usage functionality of pyalpm. But I still need to see some pyalpm.transaction.init() examples. Especially, how are we passsing arguments to that. (e.g list, tuples, keywordargs,str??). And also, should I pass some arguments to pyalpm.transaction.prepare() or, just use it as it is?
Edit:2
Appearantly, pycman package have lots of them, so I am marking this thread solved.
Last edited by yasar11732 (2011-07-01 23:16:21)I'm having the same issue. Has anyone found a solution?
-
[Solved] mtp usage
I have just started using mtp to transfer files to my mobile phone & it works fast & flawlessly (yeah!)
My only concern is dismounting / disconnecting the phone when the transfer is complete.
Q1 is this required ? will data be corrupted if I just unplug the usb cable?
Q2 what command do I need to use ?
I have searched everywhere for an answer to above, but am drawing a blank.
ps not looking for suggestions of alternatives to mtp.
Last edited by flipper T (2013-12-17 03:29:19)Found this post (here : http://forum.xda-developers.com/showthr … t=1469519)
Galaxy Nexus uses MTP for file Transfers in contrast to older versions that uses USB mass storage (in effect emulating an USB-Stick).
MTP is a lot safer, because the PC doesn't get to the lowlevel filesystem details, so it can't ruin them with a bad unplug.
When using MTP worst cases are when the file is still transferring it might not get saved completely. Well in theory android could get confused, but i don't think that will happen.
With USB mass storage as protocol the worst case is an unreadable file system, but that protocol isn't available on stock google nexus.
In short: It's save.
I don't do windows, but maybe that's why windows doesn't even show the icon: It not needed.
...seems applicable / will mark as solved.
Last edited by flipper T (2013-12-17 03:28:59) -
[solved] grep today, yesterday & the day before
Wah! (= "hi!")
I'm trying to grep the last three days of a list - It's killing me:
| grep -e "\($(($(date +%d)-0))\|$(($(date +%d)-1))\|$(($(date +%d)-2))\) $(date +%b)"
echo grep[stufffromabove] says:
grep -e \(25\|24\|23\) Aug
... cat list.txt | grepstufffromabove shows no lines at all. Tried several variations of the line, started all over again a few times but I keep messing it up at some times... yes, and I must admit, I've been confusing myself using about 3 different "regex versions" today (uhm... sed, grep, perl, php?), so maybe I keep messing it up this way again....
Could someone tell me what I'm doing wrong?
Last edited by whoops (2009-08-25 19:08:08)Thanks but...
I just sort of just figured out the obvious and noticed, that I'd even have a big problem if that regex of mine worked.... unluckily, there actually seem to be days with a number smaller than 3, but no negative days in the human calendar... so I'm going to rest first and think it over after that. Most likely I'm going to end up subtracting a day in unix-time and converting back, better ideas are not necessary but welcome .
(edit: oh, and thanks again - that might come handy when I ended up with the same $(\[chaos\]) trying the unix time version later)
Last edited by whoops (2009-08-25 18:29:30) -
[SOLVED]grep in bashrc not found in root user
Crap nothing to see here when I went to post the contents of the bashrc from root I noticed the PS1 had a call to grep in that manner and could have sworn I verified before posting.
Mods delete if you wish sorry for the noise and wasted space !!!
I have a couple things in my bashrc for root and a day or two ago I noticed when I sudo su to root it now says
bash: /bin/grep: No such file or directory
Nothing in my bashrc calls grep in any manner other than just "grep" there are no calls to it by a full path nor the path its stating. Any ideas on what I might have done? Grep still works as root of course and the error does not show up as my regular user and the part in bashrc for both users are the same that have the grep call in it.
Thanks for your time and help.
edit: the dawning on myself im a tard and man you guys on the forums are the fastest on the net I think, SO AWESOME to me
Last edited by vwyodajl (2012-02-15 22:13:24)[karol@black ~]$ which grep
/usr/bin/grep
Please read pacman's output:
[2012-02-08 17:58] ATTENTION UDEV:
[2012-02-08 17:58] ----------
[2012-02-08 17:58] udev-compat has been removed, and should be uninstalled.
[2012-02-08 17:58] --
[2012-02-08 17:58] Framebuffers are no longer blacklisted by default.
[2012-02-08 17:58] --
[2012-02-08 17:58] binaries moved from /sbin to /usr/bin
[2012-02-08 17:58] ---------------
[2012-02-08 17:58] upgraded udev (180-1 -> 181-2)
Last edited by karol (2012-02-15 22:13:27) -
[SOLVED] grep output matching parts only
I want grep to output only what it matched, but according the man page, it will put each matching part on a separate line, which does not work for me. I am matching two numbers, but they don't get output together, but each on a separate line. Any idea how to fix this?
Here is my code:
[x@arch ~]$ sudo hddtemp /dev/sda|cut -f4 -d" "|grep [[:digit:]+] -o
4
6
Last edited by awayand (2012-03-31 05:08:06)awayand wrote:
genius. thanks, dev/zero!
sudo hddtemp /dev/sda |cut -f4 -d" "|tr -cd [:digit:]
Haha, the actual solution you found is more elegant than the one I had in mind!
sudo hddtemp /dev/sda | cut -f4 -d" " | grep [[:digit:]+] -o | tr '\n' ' ' | sed 's| ||g' -
[solved] grep german umlaut using regex? use iconv
Hi guys,
when grepping
"<condition data="Bewölkt"/><temp_f data="45"/>"
i don't get any output.
The same grep sequence works fine for words like "Leichter Regen" or "Klar", so i suspect grep fails because of the german umlaut ("ö" in this case).
Now, this is my current locale:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
If i export LC_ALL=de_DE i no longer get 0 output but rather "Bew" instead of "Bewölkt" or "Meistens" instead of "Meistens bewölkt".
Any ideas how to teach grep to use iso-8859-15 or something like that?
Here's the relevant part of the function:
declare -a wetter
wetter=(`curl -silent "http://www.google.de/ig/api?weather=$1+$2+$3" | grep -o 'condition data=\"[A-Z].*\"/><temp_f' | grep -o '[A-Z][a-z]*'`)
echo Wetter: $wetter
Last edited by demian (2010-04-27 16:47:26)Yes, i was just now getting into regular expressions and sed so my functions will be very dirty for the time being . I'll try the sed command though, thank you.
I tried iconv as well as your suggestions but the problem remains.
When i save the .xml file on my hard drive i can grep "bewölkt" but not when i use curl to view the data. When i use curl grep simply ignores everything after the umlaut:
curl -silent "http://www.google.de/ig/api?weather=Berlin" | grep -o 'condition data=\"[[:alpha:]]*.*'
condition data="Meistens bew
condition data="Wind: W mit Windgeschwindigkeiten von 23 km/h"/>[...]
Maybe the problem is that i don't seem to have iso8895* locales.
> fd /usr en_US
/usr/lib/tupac/localization/en_US.php
/usr/share/X11/locale/en_US.UTF-8
/usr/share/X11/locale/en_US.UTF-8/Compose
/usr/share/X11/locale/en_US.UTF-8/XI18N_OBJS
/usr/share/X11/locale/en_US.UTF-8/XLC_LOCALE
/usr/share/i18n/locales/en_US
/usr/share/locale/en_US
/usr/share/locale/en_US/LC_MESSAGES
/usr/share/locale/en_US/LC_MESSAGES/wget.mo
/usr/share/vim/vim72/spell/en/en_US.diff
> fd /usr de_DE
/usr/lib/tupac/localization/de_DE.php
/usr/share/i18n/locales/de_DE
/usr/share/i18n/locales/de_DE@euro
/usr/share/vim/vim72/lang/menu_de_de.latin1.vim
/usr/share/vim/vim72/lang/menu_de_de.utf-8.vim
/usr/share/vim/vim72/spell/de/de_DE.diff
Sorry, I've never localized the system before. I always found it convenient just to stick with en_US.utf8 until now.
I've already changed the function to use google.com so i don't have the umlaut-problem anymore.
Regards,
demian
Last edited by demian (2010-04-27 10:04:31) -
[SOLVED] Remote usage
I'm kind of used to VNC and TeamViewer to give support to my machines but I want to ask for something completely different.
I want to setup a headless machine and remotely (from what is usually called a dumb terminal) connect to the machine and use its window manager and everything as if i was phisically using that machine with the keyboard and mouse plugged on it, but via network..... Is this so uncommon or difficult?
Thanks.
Last edited by Xi0N (2012-12-23 22:17:50)I am using xvfb with x11vnc and ssh. I tried vncserver before but it could not handle i3 (no xkb extension or something like that).
On remote machine (under screen / tmux so it won't dissapear if i'm disconnected):
Xvfb :1 -nolisten tcp -screen 0 1280x1024x16
DISPLAY=:1 i3
x11vnc -display :1 -localhost
On local machine:
ssh -L 5900:localhost:5900
(or putty: connection -> ssh -> tunnels)
This gives you encrypted persistent vnc session. On reconnect you need to start x11vnc once again. -
[solved] stat64() usage in C
Can someone tell me how to use the large file functions, especially stat64()? I always get
warning: implicit declaration of function 'stat64'
and for the struct stat64 named "filestat"
error: storage size of 'filestat' isn't known
I already crawled every page I found via google and tried with no success:
- compiling with -D_FILE_OFFSET_BITS=64
- #define __USE_LARGEFILE64
- #define _LARGEFILE_SOURCE
- #define _LARGEFILE64_SOURCE
Any suggestions? Thanks in advance!
lynix
Last edited by lynix (2009-10-23 21:11:22)why not use just the stat instead of stat64 ??
i rly dont know what this c program need to do i'm a beginner c/c++ programmer, but at least i can use google and i found that use stat instead of stat64...
and i tried to and compiles without a problem, so i think it need to be good
1 /*
2 * =====================================================================================
3 *
4 * Filename: test.c
5 *
6 * Description:
7 *
8 * Version: 1.0
9 * Created: 10/23/2009 11:52:20 PM
10 * Revision: none
11 * Compiler: gcc
12 *
13 * Author: Czaka Hunor (), [email protected]
14 * Company:
15 *
16 * =====================================================================================
17 */
18
19 #include <sys/stat.h>
20
21 #define __USE_LARGEFILE64
22 #define _LARGEFILE_SOURCE
23 #define _LARGEFILE64_SOURCE
24
25 int main()
26 {
27 struct stat mystat;
28
29 stat("/etc/fstab", &mystat);
30
31 return 0;
32 }
┌─[ hybrid@arch ~ ]
└─[ $> gcc -Wall -c test.c
test.c: In function 'main':
test.c:27: error: storage size of 'mystat' isn't known
test.c:29: warning: implicit declaration of function '_stat64'
test.c:27: warning: unused variable 'mystat'
┌─[ hybrid@arch ~ ]
└─[ $> gcc -Wall -c test.c
┌─[ hybrid@arch ~ ]
└─[ $> gcc test.o -o test
┌─[ hybrid@arch ~ ]
└─[ $> ./test
┌─[ hybrid@arch ~ ]
└─[ $>
hope i helped -
[SOLVED] swap usage when there is plenty of ram availibale
Hi guys, I'm not sure if this is correct subforum, but here is the question
By default linux kernel uses swap partition even if there is lots of ram availiable. What's the purpose of this? And is there a way to turn this off in Arch.
Last edited by ogronom (2008-11-03 18:59:10)found 2 articles (pretty old) about this issue
http://www.beranger.org/index.php?article=1547&page=3k
http://lwn.net/Articles/83588/ -
[SOLVED] Check for old configuration files and directories in ~/
Hello,
Since I started with Arch I tried and uninstalled a few programs and would like to check for possible left overs in ~/
I tried the "lostfiles" script, but it does not seem to check the home directory. Then I followed this: https://wiki.archlinux.org/index.php/Pa … ny_package - But using the suggested alias in my bash, it gives me the below:
$ pacman-disowned-files
[sudo] password for [my user]:
bash: -path: command not found
bash: /root: Is a directory
bash: -print: command not found
What am I doing wrong?
Regards
Martin
Last edited by onslow77 (2015-02-04 23:52:44)Hello,
ohh, I see, I need to do this (in directory where I put the script)
sh pacman-disowned -files > test.txt
That solved the usage of the commands, but it does not however list files [in the test.txt file] that do not belong to any package in my ~/ directory (I put a dummy file in my ~/ to see if it got noticed) - but it did not. So how can I list files and directories in my ~/ directory that is not put there by any package that currently is installed?
Regards
Martin
Last edited by onslow77 (2015-02-04 22:49:11) -
Zedboard BSP build fails out of the box
Hello,
I downloaded the Petalinux 2015.2 tools and the Avnet Zedboard 2015.2 BSP
However, as soon as I try petalinux-build after the creation of the project, i get the error:
[...I skip the initial messages which all look correct...]
[INFO ] Update and install vmlinux image
[INFO ] vmlinux linux/kernel
[INFO ] install linux/kernel
[INFO ] package zImage
[INFO ] zImage linux/kernel
[INFO ] install linux/kernel
[ERROR] ERROR: Invalid ELF file '/home/lopez/Petalinux-Projects/Avnet-Digilent-ZedBoard-2015.2/images/linux/vmlinux'
[ERROR] make[1]: *** [package-subsystem-FIT] Errore 255
ERROR: Failed to build linux.
Also, if I try to boot the prebuilt image with petalinux-boot --qemu --prebuilt 3 I get:
INFO: The image provided is a zImage
INFO: Set QEMU tftp to /home/lopez/Petalinux-Projects/Avnet-Digilent-ZedBoard-2015.2/images/linux
Uso: grep [OPZIONE]... MODELLO [FILE]...
Usare "grep --help" per ulteriori informazioni.
INFO: TCP PORT is free
INFO: Starting arm QEMU
INFO: qemu-system-aarch64 -L /opt/Xilinx/petalinux-v2015.2-final/etc/qemu -M arm-generic-fdt-plnx -machine linux=on -display none -kernel /tmp/tmp.NrxdGEgjgl -gdb tcp::9000 -dtb /tmp/tmp.pkk2bd9Zfu -tftp /home/lopez/Petalinux-Projects/Avnet-Digilent-ZedBoard-2015.2/images/linux
Xilinx QEMU Jul 13 2015 04:08:08.
qemu-system-aarch64: Unable to get size of device tree file '/tmp/tmp.pkk2bd9Zfu'
qemu-system-aarch64: Error: Unable to load Device Tree /tmp/tmp.pkk2bd9Zfu
I don't know if the error is connected to the wrong grep usage at the beginning of the flow.
Anybody can help? Much appreciated thanks
GiorgioAlso seeing this issue on custom hardware.
I'm using a VM to develop:
Guest System: Ubuntu 14.04.2 LTS
Host System: Windows 7 Professional SP 1 64 bit
In the terminal output, I'm getting:
[INFO ] package rootfs.cpio to /home/bharris/plnx/plnx.plnx/images/linux
[INFO ] Update and install vmlinux image
[INFO ] vmlinux linux/kernel
[INFO ] install linux/kernel
[INFO ] package zImage
[INFO ] zImage linux/kernel
[INFO ] install linux/kernel
[ERROR] ERROR: Unable to create FIT image
[ERROR] make[1]: *** [package-subsystem-FIT] Error 255
ERROR: Failed to build linux
In build/build.log:
[ALL ] kernel_loadaddr=$(grep -e "^CONFIG_SUBSYSTEM_MEMORY_.*_KERNEL_BASEADDR=" "/home/bharris/plnx/plnx.plnx/subsystems/linux/config" | head -n1 | cut -d "=" -f 2 ); [ ! -z "${kernel_loadaddr}" ] && kernel_loadaddr="--kernel_loadaddr ${kernel_loadaddr}"; .....
[ALL ] mkimage: Can't open /home/bharris/plnx/plnx.plnx/images/linux/image.ub.tmp: No such file or directory
[ERROR] ERROR: Unable to create FIT image
[ERROR] make[1]: *** [package-subsystem-FIT] Error 255
[ALL ] make[1]: Leaving directory `/home/bharris/plnx/plnx.plnx/build/linux'
[ALL ] make: *** [package] Error 2
[ALL ] make: Leaving directory `/home/bharris/plnx/plnx.plnx/build/linux'
I've attached the build.log. Has anyone else seen this kind of output and managed to resolve the problem?
I've tried the various package installation recommendations; none have worked so far. What's really bothering me is that I was using this system just a few days ago and it did several petalinux builds absolutely fine..
Cheers,
Ben -
Aggregating data loaded into different hierarchy levels
I have some problems when i try to aggregate a variable called PRUEBA2_IMPORTE dimensinated by time dimension (parent-child type).
I read the help in DML Reference of the OLAP Worksheet and it said the follow:
When data is loaded into dimension values that are at different levels of a hierarchy, then you need to be careful in how you set status in the PRECOMPUTE clause in a RELATION statement in your aggregation specification. Suppose that a time dimension has a hierarchy with three levels: months aggregate into quarters, and quarters aggregate into years. Some data is loaded into month dimension values, while other data is loaded into quarter dimension values. For example, Q1 is the parent of January, February, and March. Data for March is loaded into the March dimension value. But the sum of data for January and February is loaded directly into the Q1 dimension value. In fact, the January and February dimension values contain NA values instead of data. Your goal is to add the data in March to the data in Q1. When you attempt to aggregate January, February, and March into Q1, the data in March will simply replace the data in Q1. When this happens, Q1 will only contain the March data instead of the sum of January, February, and March. To aggregate data that is loaded into different levels of a hierarchy, create a valueset for only those dimension values that contain data. DEFINE all_but_q4 VALUESET time
LIMIT all_but_q4 TO ALL
LIMIT all_but_q4 REMOVE 'Q4'
Within the aggregation specification, use that valueset to specify that the detail-level data should be added to the data that already exists in its parent, Q1, as shown in the following statement. RELATION time.r PRECOMPUTE (all_but_q4)
How to do it this for more than one dimension?
Above i wrote my case of study:
DEFINE T_TIME DIMENSION TEXT
T_TIME
200401
200402
200403
200404
200405
200406
200407
200408
200409
200410
200411
2004
200412
200501
200502
200503
200504
200505
200506
200507
200508
200509
200510
200511
2005
200512
DEFINE T_TIME_PARENTREL RELATION T_TIME <T_TIME T_TIME_HIERLIST>
-----------T_TIME_HIERLIST-------------
T_TIME H_TIME
200401 2004
200402 2004
200403 2004
200404 2004
200405 2004
200406 2004
200407 2004
200408 2004
200409 2004
200410 2004
200411 2004
2004 NA
200412 2004
200501 2005
200502 2005
200503 2005
200504 2005
200505 2005
200506 2005
200507 2005
200508 2005
200509 2005
200510 2005
200511 2005
2005 NA
200512 2005
DEFINE PRUEBA2_IMPORTE FORMULA DECIMAL <T_TIME>
EQ -
aggregate(this_aw!PRUEBA2_IMPORTE_STORED using this_aw!OBJ262568349 -
COUNTVAR this_aw!PRUEBA2_IMPORTE_COUNTVAR)
T_TIME PRUEBA2_IMPORTE
200401 NA
200402 NA
200403 2,00
200404 2,00
200405 NA
200406 NA
200407 NA
200408 NA
200409 NA
200410 NA
200411 NA
2004 4,00 ---> here its right!! but...
200412 NA
200501 5,00
200502 15,00
200503 NA
200504 NA
200505 NA
200506 NA
200507 NA
200508 NA
200509 NA
200510 NA
200511 NA
2005 10,00 ---> here must be 30,00 not 10,00
200512 NA
DEFINE PRUEBA2_IMPORTE_STORED VARIABLE DECIMAL <T_TIME>
T_TIME PRUEBA2_IMPORTE_STORED
200401 NA
200402 NA
200403 NA
200404 NA
200405 NA
200406 NA
200407 NA
200408 NA
200409 NA
200410 NA
200411 NA
2004 NA
200412 NA
200501 5,00
200502 15,00
200503 NA
200504 NA
200505 NA
200506 NA
200507 NA
200508 NA
200509 NA
200510 NA
200511 NA
2005 10,00
200512 NA
DEFINE OBJ262568349 AGGMAP
AGGMAP
RELATION this_aw!T_TIME_PARENTREL(this_aw!T_TIME_AGGRHIER_VSET1) PRECOMPUTE(this_aw!T_TIME_AGGRDIM_VSET1) OPERATOR SUM -
args DIVIDEBYZERO YES DECIMALOVERFLOW YES NASKIP YES
AGGINDEX NO
CACHE NONE
END
DEFINE T_TIME_AGGRHIER_VSET1 VALUESET T_TIME_HIERLIST
T_TIME_AGGRHIER_VSET1 = (H_TIME)
DEFINE T_TIME_AGGRDIM_VSET1 VALUESET T_TIME
T_TIME_AGGRDIM_VSET1 = (2005)
Regards,
Mel.Mel,
There are several different types of "data loaded into different hierarchy levels" and the aproach to solving the issue is different depending on the needs of the application.
1. Data is loaded symmetrically at uniform mixed levels. Example would include loading data at "quarter" in historical years, but at "month" in the current year, it does /not/ include data loaded at both quarter and month within the same calendar period.
= solved by the setting of status, or in 10.2 or later with the load_status clause of the aggmap.
2. Data is loaded at both a detail level and it's ancestor, as in your example case.
= the aggregate command overwrites aggregate values based on the values of the children, this is the only repeatable thing that it can do. The recomended way to solve this problem is to create 'self' nodes in the hierarchy representing the data loaded at the aggregate level, which is then added as one of the children of the aggregate node. This enables repeatable calculation as well as auditability of the resultant value.
Also note the difference in behavior between the aggregate command and the aggregate function. In your example the aggregate function looks at '2005', finds a value and returns it for a result of 10, the aggregate command would recalculate based on january and february for a result of 20.
To solve your usage case I would suggest a hierarchy that looks more like this:
DEFINE T_TIME_PARENTREL RELATION T_TIME <T_TIME T_TIME_HIERLIST>
-----------T_TIME_HIERLIST-------------
T_TIME H_TIME
200401 2004
200402 2004
200403 2004
200404 2004
200405 2004
200406 2004
200407 2004
200408 2004
200409 2004
200410 2004
200411 2004
200412 2004
2004_SELF 2004
2004 NA
200501 2005
200502 2005
200503 2005
200504 2005
200505 2005
200506 2005
200507 2005
200508 2005
200509 2005
200510 2005
200511 2005
200512 2005
2005_SELF 2005
2005 NA
Resulting in the following cube:
T_TIME PRUEBA2_IMPORTE
200401 NA
200402 NA
200403 2,00
200404 2,00
200405 NA
200406 NA
200407 NA
200408 NA
200409 NA
200410 NA
200411 NA
200412 NA
2004_SELF NA
2004 4,00
200501 5,00
200502 15,00
200503 NA
200504 NA
200505 NA
200506 NA
200507 NA
200508 NA
200509 NA
200510 NA
200511 NA
200512 NA
2005_SELF 10,00
2005 30,00
3. Data is loaded at a level based upon another dimension; for example product being loaded at 'UPC' in EMEA, but at 'BRAND' in APAC.
= this can currently only be solved by issuing multiple aggregate commands to aggregate the different regions with different input status, which unfortunately means that it is not compatable with compressed composites. We will likely add better support for this case in future releases.
4. Data is loaded at both an aggregate level and a detail level, but the calculation is more complicated than a simple SUM operator.
= often requires the use of ALLOCATE in order to push the data to the leaves in order to correctly calculate the aggregate values during aggregation.
Maybe you are looking for
-
I have hp 430 laptop,how can i re install the windows 7, if i not have original windows on my laptop. i have oem number, But i have troubol to finishing installation of window.
-
How to correctly export and share an ADF project?
We are having some trouble with our SVN, so for the moment I am trying to share an ADF application I started developing with another developer by making a zip file of the entire application directory. We are both using JDeveloper 11.1.1.6. My colleag
-
What version of Firefox is compatible with Mac OS 10.6.8?
I get e-mail through gmail. My gmail now says that my Safari browser is unsupported, I can't update my Safari beyond what it already is (5.1.10). Is there a Mozilla Firefox that I can install that is compatible with my MacBook OS 10.6.8 and that will
-
Strange bug with CC panel and OS X Spaces
I seem to have a strange bug where the CC panel opens each time I switch spaces in OS X (click on the GIF animation below). Anyone else have this problem?
-
ITunes keep sgiving me an unknow n error when I try to burn to a blank CD-RW. It works with a regular CD-R. Can't iTunes burn to a rewritable disk? Any ideas? Thanks! (P.S. Running Windows Vista)