Need solution to formatting issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need solution to formatting issue
# 1  
Old 03-11-2011
Need solution to formatting issue

Hi All,

I have written a grep command to grep the files containing Windows directories.
I need to output this to a csv.

So here is the code.

Code:
 
OUTPUT_FILE="Sample-format.txt"
ACT_OUTPUT_FILE="Sample-format.csv"
 
grep -wHrnI --exclude=*.log '[A-Za-z]:[/\]\{1,2\}[A-Za-z]*[/\]\{1,2\}*' .>$OUTPUT_DIR/$OUTPUT_FILE
paste -s -d"\n" $OUTPUT_DIR/$OUTPUT_FILE|tr ":" "|" >>$OUTPUT_DIR/$ACT_OUTPUT_FILE

Now the problem is, when i do
Code:
 tr ":" "|"

, then the search result which contains windows path like for eg: C:\jfj\ff is getting divided into two columns. Image

Can anybody please give me some inputs to solve this problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk Script Output in Outlook Formatting Issue

When i execute the below shell script with 2 different Input files, for one of the data files (datafile1) my email message body in the outlook messes up and every thing comes up in one line. May i please know what i am doing wrong here or how to fix this? The only difference in data files is one is... (1 Reply)
Discussion started by: Ariean
1 Replies

2. Solaris

Syslog formatting issue

Hi, I am using log4j syslog appender to redirect the application logs to the solaris syslog. However, I am facing issue in formatting. It is not able to interpret new line characters and is printing \n as it is. Ex: Following is getting written into the syslog file. "\n \n File =... (4 Replies)
Discussion started by: Pra
4 Replies

3. Windows & DOS: Issues & Discussions

email from *nix to Exchange - text formatting issue

Oracle Linux 5.6 x-86-64 (Red Hat derivitive) I have several shell scripts that capture output to a log file, then use that log file as the source of an email. For a very simplified example: echo Today is `date` >> $logfile /bin/mail -s "$subject" "$sendto" < $logfile (yes, $subject... (6 Replies)
Discussion started by: edstevens
6 Replies

4. Shell Programming and Scripting

Space formatting issue in sed

How to remove any space around a specific charachter from a string using sed. for exmple : the string is like following str1='"name", "roll", "addr","job", "pay",' I need to remove all the spaces aronnd the commas. (8 Replies)
Discussion started by: mady135
8 Replies

5. Shell Programming and Scripting

Formatting issue

I am running this query in a SQL session : info_dtls=`sqlplus -s / <<eof whenever sqlerror exit 1 set feedback off; set verify off; set echo off; set heading off; select trim(a.cont_title)||'","'||trim(b.cpgrp_desc)|| '","'||trim(to_char(to_date('20100930','yyyymmdd'),'MM/DD/YYYY'))||... (1 Reply)
Discussion started by: mady135
1 Replies

6. Solaris

Mail issue solution query- host map: lookup (domain): deferred

Hi all I had a mail issue earlier today where I was not receiving any emails from the servers of one of our clients. The mail queue just showed this: -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- o8S7eSpp020274* 5858 Tue Sep 28 10:42... (0 Replies)
Discussion started by: notreallyhere
0 Replies
Login or Register to Ask a Question
ZGREP(1)						    BSD General Commands Manual 						  ZGREP(1)

NAME
zgrep, zegrep, zfgrep -- print lines matching a pattern in gzip-compressed files SYNOPSIS
zgrep [grep-flags] [--] pattern [files ...] zegrep [grep-flags] [--] pattern [file ...] zfgrep [grep-flags] [--] pattern [file ...] DESCRIPTION
zgrep runs grep(1) on files or stdin, if no files argument is given, after decompressing them with zcat(1). The grep-flags and pattern arguments are passed on to grep(1). If an -e flag is found in the grep-flags, zgrep will not look for a pattern argument. zegrep calls egrep(1), while zfgrep calls fgrep(1). EXIT STATUS
In case of missing arguments or missing pattern, 1 will be returned, otherwise 0. SEE ALSO
egrep(1), fgrep(1), grep(1), gzip(1), zcat(1) AUTHORS
Thomas Klausner <wiz@NetBSD.org> BSD
December 28, 2003 BSD