append o/p of grep in colomns


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting append o/p of grep in colomns
# 1  
Old 05-01-2008
Question append o/p of grep in colomns

Hi,

I am having a huge list of files out which i m just grepping files with extension .txt. For that i am using:

ls |grep .txt

And I am getting the desired o/p. But my o/p is too long (100 of files with .txt extension) thgat its going out of screen, like follow:

a.txt
b.txt
dg.txt
.......
.......
.......
.......
.......

and so on - 100 or 1000 of fies.

Is that any way to append o/p of grep in colomns as follow:

a.txt b.txt dg.txt
n.txt pp.txt rm.txt
...... ....... ........
...... ....... ........

Thanks-
Yogi
# 2  
Old 05-01-2008
You don't need any grep command in this case, simply issue:

Code:
ls *.txt

And that's done! The output of ls will be already in columns.
# 3  
Old 05-01-2008
Quote:
Originally Posted by robotronic
You don't need any grep command in this case, simply issue:

Code:
ls *.txt

And that's done! The output of ls will be already in columns.
Thanks Robotonic - I am out of troble now. Sometimes small small things gets out of mind and you get stuck with big big problems.

Thanks for your help.

Yogi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep and append

Have a string as below in a file. "anohter boy has id 000921 and girl has id=655 of roll number" using grep below commands with grep commands but able to get one string at a time, not able to append. less <filename> | grep -o -P '(?<=id ).*(?=and )' less <filename> | grep -o -P... (1 Reply)
Discussion started by: Satyak
1 Replies

2. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

3. Shell Programming and Scripting

Delete first blank colomns in a file

I need sed/awk operation performed on this file contents, so that the first blank columns are deleted. 11.22.33.44 asasoooooo 22.33.44.55 asapppppppp 44.55.66.77 SSSSSSSSS The final output should be as follows. (8 Replies)
Discussion started by: anil510
8 Replies

4. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

5. Shell Programming and Scripting

AWK/GREP: grep only lines starting with integer

I have an input file 12.4 1.72849432773174e+01 -7.74784188610632e+01 12.5 9.59432114416327e-01 -7.87018212757537e+01 15.6 5.20139995965960e-01 -5.61612429666624e+01 29.3 3.76696387248366e+00 -7.42896194101892e+01 32.1 1.86899877018077e+01 -7.56508762501408e+01 35 6.98857157014640e+00... (2 Replies)
Discussion started by: chrisjorg
2 Replies

6. UNIX for Dummies Questions & Answers

Grep search and append

I'm sure glad I found this forum... This is my first post, so please be gentle... ;) I tried searching everywhere, but the terminology is so common that I cannot find a solution to my problem. I'm looking for a GREP statement to do the following... I need a search and append function... (5 Replies)
Discussion started by: rmanke
5 Replies

7. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

8. UNIX for Dummies Questions & Answers

Append file with grep output but add timestamp?

I've setup a cron job that greps a file every five minutes and then writes (appends) the grep output/result to another file: grep "monkey" zoo.log | tail -1 >> cron-zoo-log Is there any way I can add the date and time (timestamp) to the cron-zoo-log file for each time a new line was added? ... (12 Replies)
Discussion started by: Sepia
12 Replies

9. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

10. Shell Programming and Scripting

append a string to a grep result

hello, iostat -En | grep Vendor | grep -v DV | awk '{print $1 $2}' | sort -u returns Vendor:HP I want to append Disk to it. i.e.: Disk Vendor:HP how to do that? thanks (8 Replies)
Discussion started by: melanie_pfefer
8 Replies
Login or Register to Ask a Question