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)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)