Sponsored Content
Full Discussion: Double grep and replacing
Top Forums UNIX for Beginners Questions & Answers Double grep and replacing Post 302995505 by arunkumar_mca on Thursday 6th of April 2017 02:39:44 PM
Old 04-06-2017
Below is the example

sample input
Code:
000442249411023001312016031500000000000000001872000000000000000
000442249411023001312016032100000000000000001872000000000000000
000442249411023001312016032100000000000000001872000000000000000
000442249411023001312016033100000000000000001872000000000000000
000442249511023001312016031500000000000000001872000000000000000
000442249511023001312016032100000000000000001872000000000000000
000442249611023001312016032100000000000000001872000000000000000
000442249611023001312016033100000000000000001872000000000000000

desired output
Code:
000442249411016001312016031500000000000000001872000000000000000
000442249411016001312016032100000000000000001872000000000000000
000442249411016001312016032100000000000000001872000000000000000
000442249411016001312016033100000000000000001872000000000000000
000442249511023001312016031500000000000000001872000000000000000
000442249511023001312016032100000000000000001872000000000000000
000442249611023001312016032100000000000000001872000000000000000
000442249611023001312016033100000000000000001872000000000000000


Last edited by Scrutinizer; 04-06-2017 at 04:38 PM.. Reason: Quote tags => code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing the string after certain # of double quote

Could you please help in unix scripting for below scenario... In my input file, there might be a chance of having a string ( Ex:"99999") after 5th double quote for each record. I need to replace it with a space. Ex : Input : "abcdef","12345","99999","0986"... (3 Replies)
Discussion started by: vsairam
3 Replies

2. Shell Programming and Scripting

Replacing comma with in double quotes in a csv file

Hello, I need to read a csv file and I am trying to replace a comma with a text DSEE?DSEE. Example Input "Chapter","NewTrains, "oldTrains","Delayed",10,"London" "Chapter","Newbuses,oldbuses","On Time",20,"London" Output "Chapter","NewTrainsDSEE?DSEE... (5 Replies)
Discussion started by: venkatvani
5 Replies

3. UNIX for Dummies Questions & Answers

Replacing grep with awk

This may be a repetitive or simple question, but I have a long running code, which uses a grep with a big argument, and i was wondering if there was a way to replace all of my greps with awk....here are my two commands using greps. x=$(ls /my/directory/here | grep -h ".$variable") and ... (1 Reply)
Discussion started by: jgrosecl
1 Replies

4. Shell Programming and Scripting

Replacing grep with awk

how to replace grep with awk commands. i have a code like: grep -w $student $markfile|$subjectid can similar code be written by replacing grep with awk. Thanks in advance, regards, giri (6 Replies)
Discussion started by: girijan
6 Replies

5. UNIX for Dummies Questions & Answers

Replacing double spaces with single space

I am looking for a regular expression that uses sed to replace multiple spaces with single spaces on every line where it is not at the start of the line and not immediately before double slashes ('//') or between quotes ("). In its simplest form, it would look like this: sed -e 's# # #g'... (4 Replies)
Discussion started by: figaro
4 Replies

6. Shell Programming and Scripting

Replacing double quotes with the unicodes "urgent!"

Hi, I have the following text in a file <div class="snippet abstract"> We present a new "model" for multiple-input-multiple-output (MIMO) 'outdoor' has many things "what" ever </div></a href=sdfkkf"> </div> <div class="snippet context"> I have to replace the string between the <div... (1 Reply)
Discussion started by: vms
1 Replies

7. Shell Programming and Scripting

Double Grep Count

Hi Friends, I want to find all processes beginning with the name 'Admin' and then do a grep count on those processes containing a specific string i.e. However, it is giving below error ps -ef | grep ^Admin | grep -ic 'Jan' -e 'Feb' -e 'Mar' grep: Jan: No such file or directory ... (4 Replies)
Discussion started by: srkmish
4 Replies

8. UNIX for Dummies Questions & Answers

Grep and replacing with ..

Hi I'm trying trying to replace '~/Documents/research/racedata' with '..' in all files in a directory. What is the best way I should go about this? Thanks. (4 Replies)
Discussion started by: Jane Yi
4 Replies

9. Shell Programming and Scripting

Replacing Double Quote in Double Quote incsv file

Hi All , We have source data file as csv file and since data could contain commas ,each attribute is quoted into double quotes.However problem is that some of the attributa data also contain double quotes which is converted to double double quote while creating csv file XLs data : ... (2 Replies)
Discussion started by: Shalini Badal
2 Replies

10. Shell Programming and Scripting

Replacing all but the first and last double quote in a line with a single quote with awk

From: 1,2,3,4,5,This is a test 6,7,8,9,0,"This, is a test" 1,9,2,8,3,"This is a ""test""" 4,7,3,1,8,"""" To: 1,2,3,4,5,This is a test 6,7,8,9,0,"This; is a test" 1,9,2,8,3,"This is a ''test''" 4,7,3,1,8,"''"Is there an easy syntax I'm overlooking? There will always be an odd number... (5 Replies)
Discussion started by: Michael Stora
5 Replies
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)
All times are GMT -4. The time now is 11:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy