12-06-2005
Indent output of an UNIX command
Hi,
How do I indent 4 spaces for standard UNIX commands like ls -ltr (or grep)?
For example, I want ls -ltra to output as:
<<spaces here>>-rw-r----- 1 a345696 rtkdevel 455 Dec 6 14:52 file1
<<spaces here>>-rw-r----- 1 a345696 rtkdevel 455 Dec 6 14:52 file2
<<spaces here>>-rw-r----- 1 a345696 rtkdevel 455 Dec 6 14:52 file3
instead of:
-rw-r----- 1 a345696 rtkdevel 455 Dec 6 14:52 file1
-rw-r----- 1 a345696 rtkdevel 455 Dec 6 14:52 file2
-rw-r----- 1 a345696 rtkdevel 455 Dec 6 14:52 file3
I tried to do it with a functions which indents it's argument, but it did only for the last line of the output.
Any clues?
Thanks in Advance,
Suddha Satta Ray
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi folks,
Please advise which command/command line shall I run;
1) to display the command and its output on console
2) simultaneous to save the command and its output on a file
I tried tee command as follows;
$ ps aux | grep mysql | tee /path/to/output.txt
It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies
2. UNIX for Dummies Questions & Answers
Hi,
This might be a bit stupid question, but what command to use to create like a session which logs the command line, and output on to the screen?
Basically, a log to a file, where I can review what I had install, uninstall, etc.
Thank you (4 Replies)
Discussion started by: kittoinc
4 Replies
3. UNIX for Advanced & Expert Users
Hello, I need some help to interpret the below output...
What is -/+ buffers/cache?
My understanding is, total RAM is 3986152 Bytes, used RAM is 3950904 bytes.
What is buffers and cached?? Can any one please interpret this output? It would be great help if some one can help me on this?
... (2 Replies)
Discussion started by: govindts
2 Replies
4. Shell Programming and Scripting
Can i do this
Say one command
sed 's/:*/ /g' $summf
is returning
C1234
C2345
C3434
some no of rows, now this ouput i have to insert it into a DB table
how do i do this?? (2 Replies)
Discussion started by: depakjan
2 Replies
5. UNIX for Dummies Questions & Answers
how can I get the df -h command output into excel format or csv file.
df -k | tr -s " " | sed 's/ /, /g' | sed '1 s/, / /g' | column -t
df -h | column -t
I have tried as above but the format is not right. I'm not able to load the format into a excel or a table.
... (2 Replies)
Discussion started by: anita81
2 Replies
6. Shell Programming and Scripting
I'm just wondering is there any way to capture the output of a unix command in a csv format.
df -h gives the result of filesystem,free space,Used space, use %,mounted on.
Is there a way to capture the command output and format it as comma sparated or fixed length file. (3 Replies)
Discussion started by: anita81
3 Replies
7. Shell Programming and Scripting
How do i echo the output of a unix command using shell script???
Like:
echo /etc/ ls -l (2 Replies)
Discussion started by: sunny2802
2 Replies
8. Shell Programming and Scripting
Hi,
I'm writing a script that connects through ssh (using "expect") and then is supposed to find whether a process on that remote machine is running or not. Here's my code (user, host and password are obviously replaced with real values in actual script):
#!/usr/bin/expect
set timeout 1... (3 Replies)
Discussion started by: oseri
3 Replies
9. Shell Programming and Scripting
I am working on an outage script and I run a command from the command line which tells me the amount of generator failures in my market. The output of this command only gives me three digits to identify the site by. I have a master list of all sites in a separate file, call it list.txt. If my... (7 Replies)
Discussion started by: jbrass
7 Replies
10. Shell Programming and Scripting
Hi
I have script to collect file system usage statistics from few remote unix hosts and email . On the UNIX system the column spacing is fine but the email output is not aligned properly. Any tips to fix this ? (1 Reply)
Discussion started by: new2prog
1 Replies