Dumb question on (Unix) pipe

I'm a Unix newbie - you can tell this as I'm still experimenting with 'cd' and 'ls'. I don't seem to be able to 'pipe' commands.
I type 'cd Documents | ls' whihc I think should open the Documents directory and list the files but all I get is the list of files at the root. If I enter the two commands seperately it works.
I'm assuming it is something to do with 'pipe' which I'm getting from a MacBook Pro UK keybaord by typing 'shift-\'.
I'm doing something dumb but what?
Thanks.

In the example you are using you would want semi-colon
cd Documents; ls
Or just
cd Documents
ls
A very common usage of pipe would be filter the output from the ls command
ls | grep -i "pdf"
which will give you a list of all the filenames that contain "pdf' in their name.  If you just want the files that end in "pdf" it would be
ls | grep -i "pdf$"
Of course you could do the same thing using a wildcard and the ls command alone
ls *.pdf
but filtering the output of another command can be much more complex than what a simple wildcard can generate, and not all commands will allow you to select exactly what they display.
You can do more than filter via a pipe, for example
ls *.pdf | while read variable
do
    mv "$variable" "My.$variable"
done
which would rename every pdf file so it starts with "My.".  Again more complicated operations can be crafted by  combining several commands into a single pipeline.  For example
cat tmp.txt | tr 'A-Z' 'a-z' | tr -cs 'a-z' '\n' | sort | uniq | comm -23 - /usr/share/dict/words
which will list all the tmp.txt words that do not exist in /usr/share/dict/words (this is a clasic pipeline created back in the early days of Unix).
Pipelines for fun an profit.
As Frank as suggested, spend some time looking at one of the Unix shell books at your local bookstore.  The shell (in this case 'bash') basics are pretty much the same for all flavors of Unix/Linux

Similar Messages

  • My ipad mail is synced to my iMac mail account. On iPad, I can only see my inbox and sent messages. I can't see any of the folders I have created on my iMac. How do I do that? Probably a dumb question, but I know there's a lot of smart people out there!

    My iPad mail is synced to my private email account, which I organise on my iMac. On iPad, I can only see inbox and sent messages folders, not any of the other folders in my email account I have created on my iMac. How do I get iPad to show my other folders? Probably a dumb question, but I know there's a lot of smart people out there.

    If you select a mailbox, you should get an Edit button (easier to see in landscape mode). Clicking the button will provide you with check circles for the messages. You also get Delete and Move buttons at the bottom. Check the messages you want to move and then navigate to the mailbox you want to drop them into. I think as long as you can navigate to a mailbox you can move the messages to it.
    In the Mac Mail application and probably Outlook on the Windows side, you also setup rules to move messages to specific mailboxes. If the mailboxes are stored on the server, then you can have the sorting done on the server and they should appear that way on the iPad. If your later messages do not show up, you may need to have the iPad app pulled down more messages until they are all showing.

  • I am looking at buying a MacBook Air over the Pro mainly for the 12 hour battery. Just wondering if battery is compromised by upgrading to 8mb and upgrading to I7 Intel dual core. I am not very tech savvy so apologies if dumb question

    I am looking at buying a MacBook Air over the Pro mainly for the 12 hour battery. Just wondering if battery is compromised by upgrading to 8mb and upgrading to I7 Intel dual core. I am not very tech savvy so apologies if dumb question

    If both computers were configured identically, then they would both lose the same amount of battery life with respect to the same starting configuration - comparing apple to apples. I don't know how much the added RAM, etc. would reduce battery life, but it would be less for both models.
    Battery life is a tricky subject because most mfgr.s like to suggest as long a life as possible, but often do so under a set of conditions that are not common to most users. Apple is no different. Their computers do have good battery life, however. But not likely as long as what is in the ads for the typical user.

  • Dumb question re video card

    I bought a radeon 9800 pro graphics card to upgrade my 64mb. stock card and before installing noticed that the new card has one DVI port and one VGA port. the box says it runs dual displays, right now I have dual CRTs running but want to run two flat panels soon.
    so the dumb question, can I convert the VGA to DVI with just a cheap adapter and run dual flats without buying an expensive converter for the second VGA port?

    Hi Prankster,
    you wont be able to get dual digital support from the 9800 ...sorry.
    Of course, you might be able to *physically connect* two digital flat panels to the card but one of the monitor connectors will be recieving an analog video input signal from this graphic card.
    To get true dual digital support from ATI you would need the 9600 or 9700 Pro graphic cards.
    Hope this helps !
    Cheers,
    Chris Chamberlain

  • Using the USB port for an external HD dumb question

    OK. Forgive a possibly really dumb question here...
    My external HD has a USB 2.0 interface and I hooked it up to the USB port using a cable that came with an old USB 1 hub I'm not using right now.
    My dumb question is this: is there such a thing as a USB 2.0 cable? Or are the USB cables all the same?
    Also, how long should it be taking to transfer 12.1 GB of data (about 9,000 photos) from my external HD mounted on the AirMac base station to my MBP? There are still 48 minutes left and it seems an awfully long time for 12.1 GB of data. That's why I was wondering if the cable could be an issue...
    Thanks,
    doug

    I am suspecting now that my HD might really have been a USB 1.0 drive...
    doug

  • Two really quick/dumb questions!

    Hi All,
    I have just bought a new Mac Mini and hooked it up to my Samsung 55 inch TV via HDMI and everything seems do be working great.
    My two dumb questions are:
    1: where on the new OS (I had a Mac 5 years ago and things have changed) is the top "Finder" bar and "disc" icon to save files?
    2: In Safari I do not seem to have a tools bar where I can for example open another tab for a new web page.
    Hope you can help a nubby :-)

    You are running a Mini so it might be that the screen resolution is not exact for your display. I have used a Mini with a conventional display but not HDTV. You might need to go into the settings for the TV to set the screen resolution to accommodate the mini's capabilities. Sorry that  I can't offer more on that score; when I use my Sony Bravia HDTV  it is with the iPad2 and HDMI and I have encountered no issues. Perhaps someone else on the forum has better insight into the Menu Bar problem on the Samsung as the principal display. 

  • Where do i find the reference number for my preorder? and yes i no this is prob a dumb question but i cant find it anywhere......

    Where do i find the reference number for my preorder? and yes i no this is prob a dumb question but i cant find it anywhere......

        Hi droidboy52999,
    Your email won't have the same confirmation number as it was ordered over the phone. You will need the last name used for the order, the location code (this ends in 01) and an order number (five to six digit number). Please keep us posted if you need further assistance with this.
    Thank you,
    MariaC_VZW
    Please follow us on Twitter @VZWSupport

  • This is probably a dumb question, but I can't find an answer. How do I make the text on my calendar larger so I can actually read it when I print it out?

    This is probably a dumb question, but I can't find an answer. How do I make the text on my calendar larger so I can actually read it when I print it out? I am using a MacBook.

    Press "Command P" and when the Print dialogue box comes up, towards the bottom there is an option allowing you to choose the text size, i.e: small, med, large.
    Hope this helps,
    NEIL

  • Dumb question but How do you know what generation iPad you have?

    Dumb question but how do you know what generation iPad you have?  I got mine as a gift on Xmas day 2012 but don't know how to find out what version/generation it is.  Can someone help me find that info?  I have looked within settings & elsewhere and I cannot find it.  Thanks in advance!

    Append the last three characters of its serial number to http://www.everymac.com/ultimate-mac-lookup/?search_keywords= and load the page.
    (83797)

  • Using utl_file and unix pipes

    Hi,
    I'm trying to use utl_file and unix pipes to communicate with a unix process.
    Basically I want the unix process to read off one pipe and give me back the result on a different pipe.
    In the example below the unix process is a dummy one just copying the input to the output.
    I cant get this to work for a single plsql block writing and reading to/from the pipes - it hangs on the first read of the return pipe.
    Any ideas?
    ======== TEST CASE 1 ===============
    create directory tmp as '/tmp';
    on unix:
    cd /tmp
    mknod outpip p
    mknod inpip p
    cat < inpip > outpip
    drop table res;
    create table res (m varchar2(200));
    declare
    l_filehandle_rec UTL_FILE.file_type;
    l_filehandle_send UTL_FILE.file_type;
    l_char VARCHAR2(200);
    begin
    insert into res values ('starting');commit;
    l_filehandle_send := UTL_FILE.fopen ('TMP', 'inpip', 'A', 32000);
    insert into res values ('opened inpip ');commit;
    l_filehandle_rec := UTL_FILE.fopen ('TMP', 'outpip', 'R', 32000);
    insert into res values ('opened outpip ');commit;
    FOR i in 1..10 LOOP
    utl_file.put_line(l_filehandle_send,'line '||i);
    insert into res values ('written line '||i); commit;
    utl_file.get_line(l_filehandle_rec,l_char);
    insert into res values ('Read '||l_char);commit;
    END LOOP;
    utl_file.fclose(l_filehandle_send);
    utl_file.fclose(l_filehandle_rec);
    END;
    in a different sql session:
    select * from res:
    starting
    opened inpip
    opened outpip
    written line 1
    ============ TEST CASE 2 =================
    However If I use 2 different sql session (not what I want to do...), it works fine:
    1. unix start cat < inpip > outpip
    2. SQL session 1:
    set serveroutput on size 100000
    declare
    l_filehandle UTL_FILE.file_type;
    l_char VARCHAR2(200);
    begin
    l_filehandle := UTL_FILE.fopen ('TMP', 'outpip', 'R', 32000);
    FOR i in 1..10 LOOP
    utl_file.get_line(l_filehandle,l_char);
    dbms_output.put_line('Read '||l_char);
    END LOOP;
    utl_file.fclose(l_filehandle);
    END;
    3. SQL session 2:
    set serveroutput on size 100000
    declare
    l_filehandle UTL_FILE.file_type;
    begin
    l_filehandle := UTL_FILE.fopen ('TMP', 'inpip', 'A', 32000);
    FOR i in 1..10 LOOP
    utl_file.put_line(l_filehandle,'line '||i);
    --utl_lock.sleep(1);
    dbms_output.put_line('written line '||i);
    END LOOP;
    utl_file.fclose(l_filehandle);
    END;
    /

    > it hangs on the first read of the return pipe.
    Correct.
    A pipe is serialised I/O device. One process writes to the pipe. The write is blocked until a read (from another process or thread) is made on that pipe. Only when there is a reader for that data, the writer is unblocked and the actual write I/O occurs.
    The reverse is also true. A read on the pipe is blocked until another process/thread writes data into the pipe.
    Why? A pipe is a memory structure - not a file system file. If the write was not blocked the writer process can writes GBs of data into the pipe before a reader process starts to read that data. This will drastically knock memory consumption and performance.
    Thus the purpose of a pipe is to serve as a serialised blocking mechanism between a reader and a writer - allowing one to write data that is read by the other. With minimal memory overheads as the read must be serviced by a write and a write serviced by a read.
    If you're looking for something different, then you can open a standard file in share mode and write and read from it using two different file handles within the same process. However, the file will obviously have a file system footprint ito space (growing until the writer stops and the reader terminates and trashes the file) .
    OTOH a pipe's footprint is minimal.

  • Dumb Question??

    I hope the philosophy here is that there is no such thing as a dumb question.
    Here goes.
    Adobe Classroom in a Book for Premier Pro states that when opening a New Project under the Project tab you have two choices DV or HDV when in actuality the choices in my version of CS4 are HDV and QuickTime.  I have been under the impression that QuickTime can be either DV or HDV and with that premise I do not understand what my choices are.
    Thanks
    Kent

    Different people's brains work differently.  I am convinced that right
    brain/left brain only scratches the surface.  What is patently obvious
    to one is shrouded in mystery to another.
    (And then there's the issue of *my *brain.  I've killed so many of its
    cells over my 33+ years of adulthood that nothing is obvious anymore.)
    People also make mistakes.  And I mean everybody.
    -Jeff

  • HT4589 should I install each update in successive order? Or will installing the 10.7 update automatically install every previous update?  I have FCPX 10.0.0 currently. Dumb question?

    should I install each update in successive order? Or will installing the 10.7 update automatically install every previous update?  I have FCPX 10.0.0 currently. Dumb question?

    Installing 10.0.7 negates the need to install previous updates. Just install it (it will upgrade your projects to a newer format as well, from memory).
    Thankfully, the days of doing it the way you were thinking are well behind us.

  • Really dumb question re Quicktime Pro

    Good morning . .
    My Mac is running OS 10.4.9 and I have updated my Quicktime player to 7.3.1.
    Purchased Quicktime PRO, registered successfully but still only get Quicktime Player when opening the program. Any suggestions where to find QT Pro? Sorry for the dumb question but thanks for your help.
    Jon

    There is no separate QT Pro application. Successfully registering Pro enables Pro features already present in the Player. Items that previosly mentioned Pro should now just list the feature without mentioning Pro.
    Message was edited by: Dick Napoli

  • Warning... dumb question ahead:  Tech guy who set up my Mac didn't give me my password info. Didn't need it till I decided to finally download a Flash Player upgrade, which won't complete process without my Mac password.  Suggestions?

    Warning... dumb question ahead:  Tech guy who set up my Macbook Pro didn't give me my password info, and yes I forgot to ask for it.   Didn't need it till I decided to finally download a Flash Player upgrade, which won't complete process without my Mac (Admin?) password.  Suggestions anyone?

    Warning... dumb question ahead:  Tech guy who set up my Macbook Pro didn't give me my password info, and yes I forgot to ask for it.   Didn't need it till I decided to finally download a Flash Player upgrade, which won't complete process without my Mac (Admin?) password.  Suggestions anyone?
    Forgot Mac Password? How to Reset Your Mac Password (with or without CD)
    Changing or resetting an account password

  • This is in the category of "dumb" questions. I am adding a new iMac running

         This is in the category of "dumb" questions. To my home office that includes
    a 2003 power pc G5 running system 10.4.11, I am adding a new iMac running
    Lion. Question - can you share files back and forth (e.g., a Word file, camera images) by simply
    coupling the two computers through USB ports? As opposed, for example, by burning
    a DVD and using that in the other computer.

    Why wouldn't you just use the network to share files, then?  Simply set up a folder on one of your systems (I would recommend the Lion system) for sharing, turn sharing on, and then connect to it from the other system.
    You might find this article useful.

Maybe you are looking for