Help me with a bash alias [SOLVED]

I want to make a bash alias to `alias tailc=tail -n40 $1 | column -t` so I put that in my ~/.bash_profile but it does not stop after 40 lines. It goes for the whole file. What am I doing wrong?
Last edited by maggie (2012-12-15 18:36:08)

+1 - Make a function.  And `column -t` rocks.  I have been looking for a way to tail my server logs with the output being nicely formatted.  Thanks for this post.
tailc() { tail -n 40 "$1" | column -t; }
Last edited by graysky (2012-12-15 10:51:27)

Similar Messages

  • [solved]Need help with a bash script for MOC conky artwork.

    I need some help with a bash script for displaying artwork from MOC.
    Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
    mocp -Q %file
    gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last  '/'?)
    A point in the right direction would be appreciated.
    thanks, d
    Last edited by dgz (2013-08-29 21:24:28)

    Xyne wrote:
    You should also quote the variables and output in double quotes to make the code robust, e.g.
    filename="$(mocp -Q %file)"
    dirname="${filename%/*}"
    cp "$dirname"/front.jpg ~/backup/art.jpg
    Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
    thanks for the tip.
    here it is, anyhow:
    #!/bin/bash
    filename=$(mocp -Q %file)
    dirname=${filename%/*}
    cp ${dirname}/front.jpg ~/backup/art.jpg
    then in conky:
    $alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
    thanks for the help.
    Last edited by dgz (2013-08-29 21:26:32)

  • TS1453 Hi, I bought Apple tv traying to rent a movie but there problem with itunes, and there is on apple tv don't have my country. could you help me please how can I solve this problem?

    Hi, I bought Apple tv traying to rent a movie but there problem with itunes, and there is on apple tv don't have my country. could you help me please how can I solve this problem?

    Whinston,
    I live in Azerbaijan. Recently I bought apple tv in New York. When I come back to my country tried to rent movies from my country but couldn't find my country name on apple tv menu, so there is a problem I don't know how to fix it. is there have another way to take a rent movies?

  • HT1349 The nice man Joseph Shen helped me with my google problem on my iPhone and worked for 2 days and now not working again please help me solve this problem were I can retrieve my messages on the I phone when I am not at home  on my wi Fi is the only t

    The nice man Joseph Shen helped me with my google problem on my iPhone and worked for 2 days and now not working again please help me solve this problem were I can retrieve my messages on the I phone when I am not at home  on my wi Fi is the only time it works correct. Bill. [email protected]  708 752  3667 

    http://lifehacker.com/5852948/what-to-do-if-youve-forgotten-your-iphones-passcod e

  • [SOLVED] Trying to make command into bash alias

    Here is a command I would like to make into an easy to use bash alias:
    #Copy results of a find to somewhere
    find -iname "*something*" -exec cp '{}' /path/to/copy/results/to \;
    I realize there are usually several ways to do something in the shell, so if a better way of course I'm all for any tips but if I wanted to make this an alias so that I just had to do:
    alias pattern pathtocopyto
    How would I? I have tried:
    alias findcp="find -iname "$1" -exec cp '{}' $2/ \;"
    But this does not work, says it cannot find the search term when I ran it in a test dir full of properly named files and dirs.
    TIA for any help
    Last edited by colbert (2008-12-17 23:19:09)

    Hmm, I tried that Procyon, I could see the HD light on the case go solid so it was running the find but it did not work. I have a file called "layla.mp3" and a dir called "test" in the current dir, ran it like this:
    findcp layla test
    Gave no result and test was still empty Thanks for the help guys hopefully can get this to go..

  • I can't activate my programs even though I paid for a subscription.  I did a chat with the help desk and they didn't solve my problem.  I want to cancel my account.  Please contact me since the chat is down

    I can't activate my programs even though I paid for a subscription.  I did a chat with the help desk and they didn't solve my problem.  I want to cancel my account.  Please contact me since the chat is down

    Activating after a Find My iPhone lock bricks the device if you don't know the password used by Find My iPhone.
    Read through this article to find if your device has an activation lock.
    http://www.macworld.com/article/2048739/get-to-know-ios-7-activation-lock.html
    If this is what you have - the news is bad:
    http://www.cultofmac.com/246755/why-ios-7s-activation-lock-is-a-disaster-waiting -to-happen/

  • [SOLVED] systemd: Launch helper exited with unknown return code1

    Why might I be seeing messages like the following when trying to set up systemd?
    [root@blah ~]# hostnamectl set-hostname foobar
    Failed to issue method call: Launch helper exited with unknown return code 1
    EDIT: The solution for me was to remove sysvinit and initscripts and go for pure systemd.
    Last edited by amadar (2012-11-01 05:47:08)

    amadar wrote:
    2ManyDogs wrote:Did you search the forum, as I suggested?
    https://bbs.archlinux.org/viewtopic.php?id=151633
    Yeah, I already found that post but the solution is not there. I'm not trying to use echo to set hostname manually, I'm trying to see why my hostnamectl command (and other *ctl comands) doesn't work, and there's no solution on that thread, just a workaround.
    I have systemd 195 and polkit 0.107 installed.
    EDIT: I replaced sysvinit with systemd-sysvcompat; then enabled syslog-ng, NetworkManager, and cronie services using systemctl enable; then I uninstalled initscripts. I'm not sure where during that process the commands started working, but they work now. But, that doesn't help people trying to migrate without having to replace sysvinit or remove initscripts first.
    This is a problem because the wiki explicitly says to migrate rc.d settings to the new files used by systemd. However, since the *ctl commands don't work at this point, it's impossible for the user to know how to make the config files manually without intimate knowledge of their formats without using *ctl commands.
    For example, how is one supposed to complete step one on the following wiki section? https://wiki.archlinux.org/index.php/Sy … stallation
    As you can see in those instructions, there is no information on how to create the new config files other than using *ctl commands, which don't even work at that stage. Some of the examples show a sample file, but the problematice ones are the ones that don't show a sample file.
    For example, how do you make /etc/adjtime without timedatectl?
    The wiki says that timedatectl [...] "will generate /etc/adjtime automatically; no further configuration is required", but then the Failed message in my original post is displayed.
    I think I will change the wiki to offer a better walk through when I get the chance to migrate to systemd on my desktop which has many daemons and modules.
    the same problem here....

  • HELP me with my K7N2 delta ilsr

    Can anyone help me with this problem. I have just upgraded to MSI's K7N2 delta ilsr motherboard. Its all working quite well apart from the fact that the pc wont start up from cold....at all.
    When I start the pc from an off state, it runs up the fans and drives, but does not post.
    The diagnostic led pannel on the back of the pc shows that the cpu is faulty or not installed correctly.
    If I then press the reset button, the pc posts, and boots up just fine.
    It does this EVERY time I start up.
    I have tried re installing the cpu, which is an XP 2800+ 333 barton, but to no avail.
    I have asked a few questions on other forums, but I cant solve it.
    These are the suggestions so far.
    1. the psu (I have a Tsunami 400 atx psu) could not be giving out enough power on initial startup, but once the pc is running, it has enough to boot the pc from a reset.
    2. The mobo or the bios could be at fault. I have not flashed the bios, or upgraded it in any way from original, so is there an issue with the original bios on these boards, and 2800 barton chips??? Could it be a mobo fault? The pc runs fine once the machine is booted.? how do I test it?
    3. The cpu could be faulty? but would this not stop it running fuull stop?
    4. my ram. I have a single stick of OCZ 512mb pc3200 ddr, which I was told would make the pc fly. Not shure on that statement, but is this ram compatible?? could this be the problem?
    Im fairly new to the upgrade side of things, and I need some help with this one.
    Also, Id be really greatfull if some one could talk me through flashing my bios to the latest version, as the thought of doing this narks me a bit...I dont want to mess it up and get a dead pc...
    HELP

    +3.3v 14A
    +5v 28A
    +12v 16A
    +5vsb 2A
    -5v 0.5A
    -12v 0.8A
    Hope this helps, as my pc seems to be living with its case off a lot these days..haha

  • Help me with  this assignment

    can anyone out there help me with this assignment ????? i`ll attach the file to this topic
    In this assignment, you are to write a Java applet, using arrays, to simulate the functions of a drinks-vending machine.
    The assignment requirements described below are broken down into 2 stages of development, described in this document
    as 'Basic Requirements' and 'Additional Features'. You are advised to do your programming progressively in these
    stages. An Activity Plan has also been specified for you to follow. Refer to the 'Grading Criteria' on page 5 to have
    an idea of how the different components are graded.
    1.     1. BACKGROUND
    A company intends to build computerised drinks-vending machines to enlarge its business portfolio. You have been tasked to develop a
    Java applet that simulates the operation of such a machine to determine if it will meet their needs.
    2.     1. BASIC REQUIREMENTS
    The machine should have a wide range of drinks available. A customer can choose a drink according to the following criteria:
    a)     a) Category of Drinks
    �     � Beverages
    �     � Soft Drinks
    (For beverages, there is choice of whether sugar and/or creamer is required, for which there is an additional charge.)
    b)     b) Type of Beverages
    �     � Hot
    �     � Cold
    Once a customer has specified the drink he wants, the amount payable is displayed. The unit prices to be displayed are as follows:
    Drinks     Price per Cup/Packet ($)
    Beverage:     Coffee     1.00
         Tea     1.20
         Milo     1.40
         Horlicks     1.35
         Chrysanthemum     1.00
         Ginger     0.80
    Soft Drinks:     Apple     1.40
         Orange     1.40
         Pineapple     1.50
         Carrot     2.00
         Longan     1.20
         Bandung     1.00
    (For beverages, a request for sugar or creamer attracts an additional charge of $0.10 each. Creamer is not applicable for
    chrysanthemum and ginger.)
    The customer may then confirm his order by entering the amount payable (this symbolises his payment for the drink). Whenever the
    payment input is not correct, an appropriate error message is displayed, whereupon the customer has to re-enter the amount again.
    When the correct amount is paid, the required drink is dispensed.
    For any drink that is out of stock, a message is shown, stating that it is not available. Each time a drink is dispensed, the stock for that
    drink is updated (For beverages, the stock is stored in units of servings for each cup.) To simplify the testing, you may start the simulation
    by setting the stock for each drink to 10 packets or cup-servings.
    3.     2. ADDITIONAL FEATURES
    In addition, the simulator can have the following features:
    a)     a) Smart Graphical User-Interface (GUI)
    You may build upon the basic requirements by recommending alternative drinks of the same category, whenever a requested
    drink is not available (as signified from the stock). In this case, only drinks which are available (i.e., in sufficient stock) are
    displayed for the customer to choose. And if only soft drinks are available, the selections for creamer and sugar should be disabled.
    b)     b) Multiple Orders
    A customer could order more than one drink. The system could allow him to specify as many drinks as he wants, prompting him
    for an appropriate payment, and then dispensing the drinks accordingly, subject to availability. This may also entail the extension
    of the graphical user-interface.
    c)     c) Sales Analysis
    Periodically, the total revenue accumulated since the last collection is printed in descending order of sales for each drink sold,
    together with a grand total. The cash is then cleared from the machine. This feature requires password-protection.
    d)     d) Replenishment of Stock
    Periodically, the stock is checked to determine how much of each drink needs to be replenished. For this purpose, a list of the
    drinks with the corresponding quantity on hand is printed in ascending order of stock level. Drinks with insufficient stock are
    topped up to a level of 10 servings or packets. This feature also requires password-protection.
    e)     e) Any other relevant features
    You are limited only by your creativity. You can add any other relevant features for this project. Please consult your tutor before
    you proceed.
    To qualify for the full marks for this section, you need to implement 2 features, at least one of which must be either (a) or (b) above.
    4.     3. ACTIVITY PLAN
    Suggestions for Getting Started
    There are many ways that you could complete this assignment. The most important part is to think about the entire project first so that
    it is easy to integrate the various pieces. You should also consider what type of graphics you want to incorporate.
    a)     a) Analysis
    1. Understand the program specification and the requirements before attempting the project.
    b)     b) Program Design
    2.     Work out the GUI components (e.g., TextFields, CheckBoxes, ChoiceBoxes, Buttons, etc.) needed to get the user input.
    3.     3. Work out the main logic of the program using modular programming techniques; i.e. use methods appropriately. E.g., tasks that perform
    4.     4. a well-defined function or those that are repeated should be coded as methods. For example, you can write the methods, displayBill(),
    5.     5. makePayment(), computeTotal(), dispenseDrink(), etc. You need to think carefully about the return type and the parameters of each
    6.     6. method.
    7.     7. You are required to use arrays appropriately for this assignment. Marks will be deducted for inefficient use or non-usage of arrays.
    c) Implementation & Testing
    8.     8. Write the method definition of each method ONE at a time.
    9.     9. Test your program logic to make sure that it works. In the interim, you can use �g.drawString(�);� or �System.out.println(�);� to print
    10.     10. out intermediate results so that you can see whether your program is working correctly. You may not want to bother about error-checking
    11.     11. at this point. You should test each method as soon as it is written, as it is much easier to debug your program in this way.
    5.     4. DELIVERABLES
    By Monday, 25th February before 5:00 p.m., hand in the following to the School of ICT Administrative Office at Block 31, level 8:
    �     � A copy of the printout of your .java file.
    �     � A diskette labelled with your name, group, student ID. The diskette should contain ALL the necessary files (.java, .html, and .class)
    to run your applet.
    �     � The above in an envelope topped with the Assignment Completion Report (see pages 6, 7 & 8). Page 6 is for you to paste on top
    of your envelope whilst pages 7 and 8 are for you to document your Test Plan, and write your comments (including any
    special instructions to run your program) - to be inserted into the envelope.
    In your .java program, you are to include a blocked comment at the top stating:
    q     q Your name, group, student ID.
    q     q Assumptions (if any) or any deviations from the specified requirements.
    q     q Any features that you would like to highlight.
    6.     5. WALK-THROUGH OF PROGRAM
    Monday 25th February at 9:30 a.m. SHARP
    In the walk-through, you will be asked to give short, written answers to some questions about your program. These questions will assess
    your basic understanding of the code that you are handing in. If you fail to display adequate understanding of your own program, you can
    be down-graded by up to two letter grades from what you would have normally received. It is also possible that you will be called to
    perform a demonstration cum explanation of your work if it is suspected that you have copied someone else�s work. Lesson: do your own
    work and you will have no problem!
    7.     6. GRADING CRITERIA FOR PROGRAMMING
    Correct and robust implementation of basic features     55 %
    Additional features     20 %
    Programming style:�     � Program design�     � Appropriate use of arrays�     � Appropriate use of variables, methods, and parameters�     � Proper usage of control structures (e.g. if/else, loops)     15 %
    Good programming practice:�     � Meaningful variable names �     � Proper indentations�     � Useful and neat comments     5 %
    Adequate (black-box) testing:�     � Suitably-designed test plan     5 %
    Total:     100 %
    PROBLEM SOLVING & PROGRAMMING II
    (Dip IT/MMC/EI, Year 1, Semester 2)
    Assignment Completion Report (to be attached to cover of envelope)
    Name: ___________________________________ Group: ________
    ID: ___________________ Date & Time submitted: ____________
    Requirements     % Done (0-100)     Remarks
    BASIC FEATURES          
    �     � Can choose category (and select appropriate additives)          
    �     � Can choose drink (with error checking)          
    �     � Can display amount payable          
    �     � Can indicate availability of drink (with error checking)          
    �     � Can accept payment for drink (with error checking)          
    �     � Can dispense drink          
    �     � Can update stock          
    ADDITIONAL FEATURES          
    �     � Smart GUI          
    �     � Multiple Orders          
    �     � Sales Analysis (with password checking)          
    �     � Stock Replenishment(with password checking)          
    �     � Any other relevant features          
    Test Plan
    Using black-box testing, record your test specification and the results according to the following format (the examples here are provided
    for your reference only):
    Test No.     Purpose     Test Shot/Data     Expected Result     Actual Result
    E.g. 1a)     Check whether beverage can be selected      Click on �Chrysanthe-mum� button     Checkbox for �Sugar� but not �Creamer� appear     �Sugar� and checkboxes appeared
    E.g. 1b)     Check whether chrysanthemum with sugar can be ordered      Select sugar and click on �Order� button     Amount payable appears as �$1.10� (i.e., $1.00 + $0.10)     Amount payable shown as $1.10
    E.g. 1c)     Check whether correct payment can be accepted      Enter �1.00� in �Payment� textfield     Error message �Insufficient payment - $0.10 short� appears     Confirmation message �Drink being dispensed� appeared � ERROR!
    E.g. 1d)     Re-test 1c), after amending program      As above     As above     Error message �Insufficient payment - $0.10 short� appeared
    etc.                    
    etc.                    
    Remember to hand in this test plan together with the other deliverables in the envelope.
    Have you�
    1.     1. Checked to make sure program still works properly even with windows resized?
    2.     2. Tested your program thoroughly, as if you're trying to break it?
    Any comments about this assignment? Any special instructions to run your program? Write it here.

    public class testing1 {
    String gg;
    public void testing3() {
    System.out.print(gg); }
    // this is are constructor for the object and method we are going to make
    next code
    class testing {
    public static void main(String[] args) {
    testing1 tes = new testing1();
    tes.gg = "hello there";
    tes.testing3(); //here we have made a object and a method
    hope this helps

  • Help Me with Hp Pavilion dv6t-2000 , I Can't Use The Modem

    Help Me with Hp Pavilion dv6t-2000 , I Can't Use The Modem Coz A Metal Cover it  in my laptop !!

    Hi,
    Which port(s) are you talking abot ?
    Figure 3: Back I/O ports
    1 - USB 2.0: 4
    2 - LAN (ethernet)
    3 - DVI-D
    4 - DVI-I
    5 - Audio center/subwoofer
    6 - Audio rear speaker out
    7 - Audio side speaker out
    8 - Audio line-in
    9 - Audio line-out
    10 - Microphone
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Please help me with the installation process.

    i have got free norton antivirus activation keybwith the pirchase of hp 16 gb pendrive .
    please help me with the installation process.

    Hey @10p,
    Welcome to the HP Support Forums!
    I understand that you need assistance with the installation of Norton Antivirus that you received with the purchase of an HP 16gb Pendrive. Did you get the Pendrive with a computer or just purchase the Pendrive on its own?
    Once I know if the Pendrive came with the purchase of a computer I will be able to point you in the right direction for support. Good luck!
    X-23
    I work on behalf of HP
    Please click "Accept as Solution" if you feel my post solved your issue, it will help others find the solution.
    Click the "Kudos, Thumbs Up" on the right to say "Thanks" for helping!

  • Will Apple help me with this issue?

    Dear Sir or Madam,
    I am a student in China, I really need your help, my iphone now problems bothers me! HELP ME PLEASE!!!
    As I bought my iPhone 4s(16GB,White) in the USA from Sprint, full price with tax,  unlocked ,it was excepted to be a global phone. But now I come across with some problems in China  using local carrier.Now I am in China, not the normal use of the phone, I rely on odd jobs to earn, very not easy, English is not my mother tongue, maybe there are many grammatical mistakes, I hope you'll forgive me! Mobile phone can not be used normally I am very sad, I can not contact the parents and friends, can not let them worry about me, I've tried all means, including the upgrade to 6.1, but still can not solve the problem, I think maybe I am in China, so can not be used normally, at this moment I am very anxious, because of the time difference, it is later I can send mail, you can see it, please help me, a Chinese student's request!
    I tried all the possible solutions from the Internet, and the Official solution offered by Apple (http://support.apple.com/kb/TS4459), but it doesn't seem to work.
    Will Apple help me with this issue? Please do.THANK YOU VERY MUCH!!!

    We are not Apple, and Apple does not unlock phones. Sprint will unlock phones, but you have to qualify. One of the qualifications is to have been a customer in good standing for a period of time. You can check their website for what that is. After that, they can unlock the GSM side of the phone for International use, that is it. If you are on a CDMA carrier, then it cannot be unlocked. Are you trying to use a local SIM card in China?
    Your only option is to contact Sprint to see if you qualify for an unlock. Only they can unlock it. Sprint is one of the poorest choices to take to another country.

  • Help required with upgrading to OS5 on curve 8520

    Hello everyone,
    I'm using an unlocked version of the bb curve 8520 and want to upgrade my bb device os to v5.0. (current version- 4.6.1)
    I tried using the application loader on the bb website (NA & India both) but it just tells me that my OS is updated and that i will be notified if there are any updates available. I would be really grateful if someone could help me update my os.
    Solved!
    Go to Solution.

    Hello,
    Your warranty is not endangered. You are free to use any carriers OS package on your BB. Your carrier may, however, refuse to provide you with support (including Warranty evaluation/service) until you fall back to their supported device OS level. But your warranty per se is not endangered.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Help in XML data..(solved)

    Hi everyone,
    Could someone please help me to solve this..
    I have some XML data in the database in a clob column..like this..
    XMLDATA 1
    ==========
    <findPatientByNameResponse xmlns="http://service.sdt.tact.company.org">
      <out xmlns="http://service.sdt.tact.company.org">
        <ns1:patient xmlns:ns1="http://model.sdt.tact.company.org">
          <age xmlns="http://model.sdt.tact.company.org">66</age>
          <birthDate xmlns="http://model.sdt.tact.company.org">1949-11-23T00:00:00-07:00</birthDate>
          <empi xmlns="http://model.sdt.tact.company.org">544665</empi>
          <firstName xmlns="http://model.sdt.tact.company.org">A</firstName>
          <isValidPatient xmlns="http://model.sdt.tact.company.org">true</isValidPatient>
          <languageCode xmlns="http://model.sdt.tact.company.org">ENGLISH</languageCode>
          <lastName xmlns="http://model.sdt.tact.company.org">SMITH</lastName>
          <maritalStatusCode xmlns="http://model.sdt.tact.company.org">M</maritalStatusCode>
          <middleName xmlns="http://model.sdt.tact.company.org">MADELINE</middleName>
          <newEmpi xmlns="http://model.sdt.tact.company.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <newPatient xmlns="http://model.sdt.tact.company.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <sexCode xmlns="http://model.sdt.tact.company.org">F</sexCode>
        </ns1:patient>
        <ns1:patient xmlns:ns1="http://model.sdt.tact.company.org">
          <age xmlns="http://model.sdt.tact.company.org">47</age>
          <birthDate xmlns="http://model.sdt.tact.company.org">1969-04-15T00:00:00-07:00</birthDate>
          <empi xmlns="http://model.sdt.tact.company.org">540171</empi>
          <firstName xmlns="http://model.sdt.tact.company.org">A</firstName>
          <isValidPatient xmlns="http://model.sdt.tact.company.org">true</isValidPatient>
          <languageCode xmlns="http://model.sdt.tact.company.org">ENGLISH</languageCode>
          <lastName xmlns="http://model.sdt.tact.company.org">SMITH</lastName>
          <maritalStatusCode xmlns="http://model.sdt.tact.company.org">D</maritalStatusCode>
          <middleName xmlns="http://model.sdt.tact.company.org">KELLY</middleName>
          <newEmpi xmlns="http://model.sdt.tact.company.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <newPatient xmlns="http://model.sdt.tact.company.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <sexCode xmlns="http://model.sdt.tact.company.org">F</sexCode>
        </ns1:patient>
      </out>
    </findPatientByNameResponse>I have to parse the above XML...The above XML has 2 records..
    i used the following query to parse the above XML
    QUERY 1
    =======
    select extractValue(value(t),'/birthDate/text()') "birthDate"
         , extractValue(value(t),'/empi') "empi"
         , extractValue(value(t),'/firstName') "firstName"
         , extractValue(value(t),'/lastName') "lastName"
         , extractValue(value(t),'/middleName') "middleName"
         , extractValue(value(t),'/sexCode') "sexCode"
    from nw_test c,
          table(xmlsequence(extract(xmltype.createxml(c.clob_data),'//findPatientByNameResponse/out/patient'))) t
    where c.id = 1;     with the above query ...it is not returing any records....
    and just for a TEST i changed the above XML to some thing more clear
    XML DATA 2 (Just for test)
    ==========
    <findPatientByNameResponse>
      <out>
        <patient>
          <age>63</age>
          <birthDate>1949-11-23T00:00:00-07:00</birthDate>
          <empi>5446</empi>
          <firstName>A</firstName>
          <isValidPatient>true</isValidPatient>
          <languageCode>ENGLISH</languageCode>
          <lastName>SMITH</lastName>
          <maritalStatusCode>M</maritalStatusCode>
          <middleName>MADELINE</middleName>
          <newEmpi xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <newPatient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <sexCode>F</sexCode>
        </patient>
        <patient>
          <age>47</age>
          <birthDate>1967-04-15T00:00:00-07:00</birthDate>
          <empi>540171</empi>
          <firstName>A</firstName>
          <isValidPatient>true</isValidPatient>
          <languageCode>ENGLISH</languageCode>
          <lastName>SMITH</lastName>
          <maritalStatusCode>D</maritalStatusCode>
          <middleName>KELLY</middleName>
          <newEmpi xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <newPatient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
          <sexCode>F</sexCode>
        </patient>
      </out>
    </findPatientByNameResponse>
    QUERY 2
    =======
    select extractvalue(value(d),'/patient/age') as age,
        extractvalue(value(d),'/patient/birthDate') as birthddate,
        extractvalue(value(d),'/patient/empi') as empi,
        extractvalue(value(d),'/patient/firstName') as firstName,
        extractvalue(value(d),'/patient/languageCode') as languageCode,
        extractvalue(value(d),'/patient/isValidPatient') as isValidPatient,
        extractvalue(value(d),'/patient/lastName') as lastName,
        extractvalue(value(d),'/patient/middleName') as middleName
        from nw_test x,table(xmlsequence(extract(xmltype.createxml(x.clob_data), '/findPatientByNameResponse/out/patient'))) d where id = 2;with query 2 i am able to get the following output
    Age Birthdate empi firstname languagecode isvalidpatient lastname
    Got 2 records...
    Query 2 is working fine..If the change the original XML data..
    But actually i have to parse XML DATA 1
    Could someone please help me with QRERY 1 to parse XMLDATA1.
    Thanks in advance
    phani

    THose namespaces are really a pain. You should consider to have all "xmlns=" removed that are not really needed.
    SQL> r
      1  with x as (select xmltype('<findPatientByNameResponse xmlns="http://service.adt.tactical.intermountain.org"> '
      2                 ||' <out xmlns="http://service.adt.tactical.intermountain.org">'
      3          ||'    <ns1:patient xmlns:ns1="http://model.adt.tactical.intermountain.org">'
      4          ||'      <age xmlns="http://model.adt.tactical.intermountain.org">66</age>'
      5          ||'      <birthDate xmlns="http://model.adt.tactical.intermountain.org">1949-11-23T00:00:00-07:00</birthDate>'
      6          ||'      <empi xmlns="http://model.adt.tactical.intermountain.org">544665</empi>'
      7          ||'      <firstName xmlns="http://model.adt.tactical.intermountain.org">A</firstName>'
      8          ||'      <isValidPatient xmlns="http://model.adt.tactical.intermountain.org">true</isValidPatient>'
      9          ||'      <languageCode xmlns="http://model.adt.tactical.intermountain.org">ENGLISH</languageCode>'
    10          ||'      <lastName xmlns="http://model.adt.tactical.intermountain.org">SMITH</lastName>'
    11          ||'      <maritalStatusCode xmlns="http://model.adt.tactical.intermountain.org">M</maritalStatusCode>'
    12          ||'      <middleName xmlns="http://model.adt.tactical.intermountain.org">MADELINE</middleName>'
    13          ||'      <newEmpi xmlns="http://model.adt.tactical.intermountain.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>'
    14          ||'      <newPatient xmlns="http://model.adt.tactical.intermountain.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>'
    15          ||'      <sexCode xmlns="http://model.adt.tactical.intermountain.org">F</sexCode>'
    16          ||'    </ns1:patient>'
    17          ||'    <ns1:patient xmlns:ns1="http://model.adt.tactical.intermountain.org">'
    18          ||'      <age xmlns="http://model.adt.tactical.intermountain.org">47</age>'
    19          ||'      <birthDate xmlns="http://model.adt.tactical.intermountain.org">1969-04-15T00:00:00-07:00</birthDate>'
    20          ||'      <empi xmlns="http://model.adt.tactical.intermountain.org">540171</empi>'
    21          ||'      <firstName xmlns="http://model.adt.tactical.intermountain.org">A</firstName>'
    22          ||'      <isValidPatient xmlns="http://model.adt.tactical.intermountain.org">true</isValidPatient>'
    23          ||'      <languageCode xmlns="http://model.adt.tactical.intermountain.org">ENGLISH</languageCode>'
    24          ||'      <lastName xmlns="http://model.adt.tactical.intermountain.org">SMITH</lastName>'
    25          ||'      <maritalStatusCode xmlns="http://model.adt.tactical.intermountain.org">D</maritalStatusCode>'
    26          ||'      <middleName xmlns="http://model.adt.tactical.intermountain.org">KELLY</middleName>'
    27          ||'      <newEmpi xmlns="http://model.adt.tactical.intermountain.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>'
    28          ||'      <newPatient xmlns="http://model.adt.tactical.intermountain.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>'
    29          ||'      <sexCode xmlns="http://model.adt.tactical.intermountain.org">F</sexCode>'
    30          ||'    </ns1:patient>'
    31          ||'  </out></findPatientByNameResponse>') myXmlCol
    32          from dual)
    33  select --t.column_value.getClobval(),
    34      extractValue(t.column_value,'//birthDate','xmlns="http://model.adt.tactical.intermountain.org"') "birthDate"
    35  from x x1,
    36*   table(xmlsequence(extract(x1.myXmlcol,'/findPatientByNameResponse/out/ns1:patient','xmlns="http://service.adt.tactical.intermountain.org" xmlns:ns1="http://model.adt.tactical.intermountain.org"'))) t
    birthDate
    1949-11-23T00:00:00-07:00
    1969-04-15T00:00:00-07:00
    SQL> Message was edited by: copy&pasted removed some important code. Added this manually.
    Sven W.

  • Pls Help me with my hp mini laptop

    Pls Help me with  my hp mini laptop
    system disabled
    [69005685]
    This question was solved.
    View Solution.

    Hi,
    Try entering:     76963201
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

Maybe you are looking for