![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| screen saver command line on solaris10-intel | itik | SUN Solaris | 0 | 05-28-2008 12:01 PM |
| screen display help | zilla30066 | Shell Programming and Scripting | 2 | 01-30-2007 07:49 PM |
| display full unix path as part of the command line | ocelot | UNIX for Dummies Questions & Answers | 3 | 10-10-2006 03:58 PM |
| Display Printers via command line | gseyforth | Windows & DOS: Issues & Discussions | 3 | 06-28-2006 02:02 AM |
| controlling screen display | jrdnoland1 | Shell Programming and Scripting | 6 | 02-08-2002 05:09 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
how to concatenate two command in one line and get the display in one screen
Hi,
I would like to know , how to concatenate two command in one line and get the display in one screen for eg command 1 : ls -l /data/logs command 2 : ls -l /data/errors output shd be /data/logs /data/errors xx-xx-xx-xx abc.log xx-xx-xx-xx abc.err xx-xx-xx-xx abc1.log xx-xx-xx-xx abc1.err xx-xx-xx-xx abc2.log xx-xx-xx-xx abc2.err is this kind of output is possible , pls help |
|
||||
|
vino
in the script that u had provided all the files under the first for loop (outer for loop) would be listed and since there is a break statement in the second for loop for all the files from the outer for loop only the first file would be printed from the second loop. To put in more specific terms ls /data/logs 1.txt 2.txt ls /data/errors 3.txt 4.txt output would be: 1.txt 3.txt 2.txt 3.txt the file 4.txt will not be listed but the required output is of the form xx-xx-xx-xx abc.log xx-xx-xx-xx abc.err xx-xx-xx-xx abc1.log xx-xx-xx-xx abc1.err xx-xx-xx-xx abc2.log xx-xx-xx-xx abc2.err plz let me know if i had misinterpreted anywhere . *********************** you can try this... (this is not an efficient way) ls -l | /data/logs | grep -v total | awk '{print $1, $9}' > t ls -l | /data/errors | grep -v total | awk '{print $1, $9}' > t1 paste -d"\t" t t1 would give the required output |
|
||||
|
its is not working
i am getting the display like
total total 3624 total -rw-r--r-- total 1 total roam total oradba total 3575834 total Jul total 1 total 12:04 total access.log total -rw-r--r-- total 1 total roam total oradba total 7 total Jul total 1 total 12:00 total access_pointer.txt total -rw-r--r-- total 1 total roam total oradba total 88051 total Jul total 1 total 12:04 total kannel.log total |
|
||||
|
your output seems to have
string total but i had used grep -v total no way u can get total ls -l | /data/logs | grep -v total | awk '{print $1, $9}' > t ls -l | /data/errors | grep -v total | awk '{print $1, $9}' > t1 paste -d"\t" t t1 can u please the change the command to following ls -l /data/logs | grep -v total | awk '{print $1, $9}' > t ls -l /data/errors | grep -v total | awk '{print $1, $9}' > t1 paste -d"\t" t t1 and let me know how do u proceed. |
|
||||
|
actually that output is for the earlier script which u gave.. pls ignore
i have ran the latest script and got the output like this -rw-r--r-- afiedt.buf drwxr-xr-x analysis -rw-r--r-- analyzer.log drwxr-xr-x gdbm -rw------- cancel.gdbm drwx------ lost+found -rw-r--r-- change.log -rw-r--r-- message.log -rw-r--r-- counters.log.bz2 -rw-r--r-- roamer.log -rw------- dbm_messenger.dbm -rw-r--r-- dp5.log yes, the output is fine, but the thing is it is not aligned , is there any way i can get like -rw-r--r-- afiedt.buf <space><sapce> drwxr-xr-x analysis -rw-r--r-- analyzer.log<space><sapce> drwxr-xr-x gdbm -rw------- cancel.gdbm<space><sapce>drwx------ lost+found -rw-r--r-- change.log<space><sapce>-rw-r--r-- message.log -rw-r--r-- counters.log.bz2<space><sapce>-rw-r--r-- roamer.log -rw------- dbm_messenger.dbm -rw-r--r-- dp5.log |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|