grep sorting/formatting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep sorting/formatting
# 8  
Old 05-12-2006
Quote:
Originally Posted by Jaken
Ah, sorry I must have missed a bit of the code, was doing it early in the morning ¬_¬.

Is there anyway to format that so the webpages are in one colum and the seperated hits in another?

Thanks for the help btw Smilie
what kind of formatting you want..? You can put a delimiter.. that should work..
# 9  
Old 05-13-2006
Quote:
Originally Posted by vino
Code:
grep -c "$month" ./log/*.log | { read a; echo ${a##*/} ; } | sed -e "s_\(.*\):\(.*\)_\1 \2_g"

Did you try the above ?
# 10  
Old 05-13-2006
Quote:
Originally Posted by Ambikesh
what kind of formatting you want..? You can put a delimiter.. that should work..
I want it in two columns, kinda the same as in a table format, like in my original porst.

I tried putting a "\t" in the sed, whilst this spaced out the matches, they arent all aligned in a second column, due to the smaller file names.

Im thinking the 'printf' command may be better spacing the matches out into another column, though im having trouble putting it into the 'sed' sequence.

Last edited by Jaken; 05-13-2006 at 04:11 PM..
# 11  
Old 05-13-2006
Quote:
Originally Posted by vino
Did you try the above ?
I tried this, but it only returned one log
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

GREP Formatting Question

I have the following nmap file output with the multiple IP’s listed in the format below. Is there a way that GREP can format the output to just display IP and any ports that contain 'http' for that IP on its own line? file: Host: 192.168.1.xxx () Ports: 80/open/tcp//http///,... (3 Replies)
Discussion started by: FCoda10
3 Replies

2. Shell Programming and Scripting

Formatting grep and awk output

Hi there. I have a very large file and I am trying to format it so that I can pull out certain pieces of data/info and report it in spreadsheet format/style. The file has ###### which will separate each line that will be listed in the spreadsheet. Whenever I find "No" at the end of a line I want... (7 Replies)
Discussion started by: kieranfoley
7 Replies

3. Homework & Coursework Questions

Shell Script: Sorting by column using grep/awk

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: You will write a script that will read a tab-separated file that contains the names of all 50 states &... (7 Replies)
Discussion started by: tburns517
7 Replies

4. UNIX for Dummies Questions & Answers

GREP for sorting

Hi , I have a file which has a large number of sequences of type: gi_1 AASSKSKSKSSKSKSK.... series_121 DDKFKFKGKGKH gi_3 FFFFLFFLFLFLF series_1 DFFFFFF pattern_3 GEEEEEEEEE gi_2 HKKGGKGKGK series_102 HHHHH pattern_1 (2 Replies)
Discussion started by: siya@
2 Replies

5. Shell Programming and Scripting

Formatting list of IP addresses into a grep command

Hi I have an input file with a list of random IP addresses, each on a new line. Below is just an example as I omitted the real IP addresses for obvious reasons. Input: random_ip.txt 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1 10.0.0.1... (7 Replies)
Discussion started by: lewk
7 Replies

6. Shell Programming and Scripting

AWK/GREP sorting help

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this; 192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible sort... (8 Replies)
Discussion started by: sam127
8 Replies

7. Shell Programming and Scripting

Output formatting of grep

hi, I am trying to find the word "root" from the follwoing sample file: #12.12.12.2222 echo "Hai........" 11.11.1.1111 3.23.AS.AA ab.cd.df.rf /usr/bin jhhh 12.12.AF.12 /urf/sss/kk kkk su sh.s exec su root; ,root sudo -sh cosrootex (3 Replies)
Discussion started by: flamingo_l
3 Replies

8. UNIX Desktop Questions & Answers

Grep result loses formatting

I am searching for a string in a file and then redirecting the contents in another file... however the formatting is not preserved.. Can you please help me on this ... (5 Replies)
Discussion started by: blackeyed
5 Replies

9. UNIX for Dummies Questions & Answers

Sorting using count, grep and count

Hi, I trying to sort information in a file by making count for every object. For example: A B A D A B C i would like to sort out count for each object (A's, B's and etc) but in actual case i dont know the object but i know the position ofthe object. do i need to use array as well? Any... (2 Replies)
Discussion started by: sukhpal_78
2 Replies

10. Shell Programming and Scripting

Multiple Grep Results - Formatting

Hello, Perhaps someone here can help with this. I'd like to grep a plain text file for a word and output each line containing a word found to a seperate line instead of back to back. Examples: Basic command: cat file.txt > grep -i CAT > results.txt file.txt: The cat said meow The... (7 Replies)
Discussion started by: sysera
7 Replies
Login or Register to Ask a Question