Solved

a sed script

Posted on 2011-03-23
4
348 Views
Last Modified: 2012-05-11
Need a script.
Make a list of files in /usr/bin that have the letter "a" as the second character. Put the result in a temporary file.
0
Comment
Question by:zhshqzyc
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 25 total points
ID: 35201033
try

ls /usr/bin/?a* > /tmp/myfile
0
 

Author Comment

by:zhshqzyc
ID: 35201083
Can we use sed?
0
 
LVL 8

Expert Comment

by:point_pleasant
ID: 35201415
ls | sed -n '/^.[a|A].*$/p'
0
 
LVL 8

Assisted Solution

by:point_pleasant
point_pleasant earned 25 total points
ID: 35201428
sorry forgot redirect

 ls /usr/bin | sed -n '/^.[a|A].*$/p' >/tmp/filetmp
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question