Sponsored Content
Top Forums Shell Programming and Scripting compare three files and insert a blank line at each mismatch Post 302326556 by rakeshawasthi on Friday 19th of June 2009 02:12:20 AM
Old 06-19-2009
I understood your requirement already.
Have you tried some code yourself? If yes, please share.

---------- Post updated 06-19-09 at 11:42 AM ---------- Previous update was 06-18-09 at 05:17 PM ----------

To start with, you can use the below code for comparing two files and inserting blanks.
Code:
sdiff file1 file2 | awk '{
if ($1==">")
   $1="                                                                  "
if ($2=="<")
   $2=" "
print
}'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert blank line if grep not found

Hello everyone... please help if you can -- I'm stumped. Making this work will save me hours of manual labor: I need to search file2 for pattern in file1. If pattern found append file2 line to file3. If pattern not found append a blank line to file3. file1 contents example: 123 456 789... (6 Replies)
Discussion started by: michieka
6 Replies

2. Shell Programming and Scripting

insert text and add blank line

I need your help, I want to add a text every 2nd line and also a blank line after 3 line (In the output 2nd line is "changetype: modify" and every 4th line is blank line) Input file format dn: abc orclsourceobjectdn: abcd dn: bcd orclsourceobjectdn: bcda dn: cba orclsourceobjectdn:... (7 Replies)
Discussion started by: athidhi
7 Replies

3. Shell Programming and Scripting

Edited: compare two files and print mismatch

Using unix shell script, how to compare two files and print lines with mismatch? Below are the requirements: 1. The number of lines on the two files is not the same. 2. The difference/mismatch can be found on the second or third column. 3. The comparison is not between line 1 of file 1 and line... (16 Replies)
Discussion started by: kingpeejay
16 Replies

4. Shell Programming and Scripting

Insert blank line in a file

I have a file with data as below : Heading 1 ------------- Heading 1 data1 Heading 1 data2 Heading 1 data3 Heading 1 data4 Heading 2 ------------- Heading 2 data1 Heading 2 data2 Heading 2 data3 Heading 2 data4 Heading 3 ------------- Heading 3 data1 Heading 3 data2 Heading 3... (2 Replies)
Discussion started by: yoursdivu
2 Replies

5. Shell Programming and Scripting

Compare two files and mismatch report

Hi I have two files f1 and f2 and comma separated file. I need to comapre two files by field by field and not by whole line. If they match then skip the line from both the files. If they don't match write the mismatch record from f1 to f3. Assume both the files are sorted on first field. ... (5 Replies)
Discussion started by: dgmm
5 Replies

6. Shell Programming and Scripting

Compare selected columns of two files and print whole line with mismatch

hi! i researched about comparing two columns here and got an answer. but after examining my two files, i found out that the first columns of the two files are not unique with each other. all i want to compare is the 2nd and 3rd column. FILE 1: ABS 456 315 EBS 923 163 JYQ3 654 237 FILE 2:... (1 Reply)
Discussion started by: engr.jay
1 Replies

7. Shell Programming and Scripting

Insert blank line if grep not found

Hi all, I've googling around forum regarding my prob, the nearest would same as thread tittled Insert blank line if grep not found, but she/he did not mention the solution, so I would like to request your help I've this task, to search in file2 based on pattern in file1 and output it to... (4 Replies)
Discussion started by: masterpiece
4 Replies

8. Shell Programming and Scripting

insert blank line between lines

Hello, I am trying to write a script that will count the number of characters for each line in a file and all the lines that have less than 80 characters and that are ending with a period, I want it to insert a blank line after them immediately. But, for whatever reason the condition if ]] is... (3 Replies)
Discussion started by: Pouchie1
3 Replies

9. Shell Programming and Scripting

sed - How to insert line before the first blank line following a token

Hello. I have a config file (/etc/my_config_file) which may content : # # port for HTTP (descriptions, SOAP, media transfer) traffic port=8200 # network interfaces to serve, comma delimited network_interface=eth0 # set this to the directory you want scanned. # * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies

10. AIX

Compare two files and show the mismatch columns

I need to compare two files and find the mismatch columns in it for csv and fixed width file. Eg: file1 c1,c2,c3,c4<----columnname 1,a,4,d 2,b,5,e 3,c,6,f file2 c1,c2,c3,c4<----columnname 3,x,7,f 2,y,8,e 1,z,9,d output c2,c3<---- mismatch columname a,4 x,7 b,5 or y,8 Ok with... (3 Replies)
Discussion started by: sabzR
3 Replies
S5(1)							    BSD General Commands Manual 						     S5(1)

NAME
s5 -- set up and update S5 presentations SYNOPSIS
s5 [-Nv] [-d dir] [-f configfile] [-t template] [-T full] blank path s5 [-Nv] [-d dir] [-f configfile] [-t template] [-T full] cksum path s5 [-Nv] [-d dir] [-f configfile] [-t template] [-T full] mksum path s5 [-Nv] [-d dir] [-f configfile] [-t template] [-T full] update path s5 -h s5 help DESCRIPTION
The s5 tool eases the creation of presentation slides using the ``Simple Standards-based Slide Show System''. It may be used to create a working copy of a template directory or, later, to update the working copy after the template has changed over time. The s5 tool supports the following command-line options: -d Specify the top-level directory containing the available templates. -h Display a short help text and exit. -N No-operation mode; just display the commands without executing them. -t template Specify the template within the directory given by the -d option. -T full Specify the full path to the template directory instead of the default /usr/share/s5/s5-blank -v Verbose operation; display diagnostic information. The s5 tool supports the following actions: blank path Aliases: create, new Copy the template directory into the directory specified by path, creating it if necessary. cksum path Aliases: check, verify Verify the checksums recorded for the S5 presentation files in the directory specified by path. The s5 utility reports both files that have been modified (fail the checksum check) and files that no longer exist yet have checksums recorded. help Alias: usage Display a short help message and exit. mksum path Record the template checksums into a file in a directory specified by path. Users should never really have to execute this by hand, since it is done internally as part of the blank and update command processing. update path Update the S5 presentation files in the directory specified by path with the new versions in the S5 template directory. Before updating, the s5 utility verifies the checksums of the files in the path directory, and terminates if a mismatch is found. After that, s5 checks for any files that exist in both the new template and in the path directory, but are not recorded in the check- sum file (i.e. have been placed in path by hand after the last s5 blank or s5 update run) and terminates if any such files differ. If all these checks are successful, the s5 utility copies the template files over those in path, overwriting any existing files and retaining any files that do not exist in the template directory. THE CONFIGURATION FILE
The s5 utility's operation may be customized by specifying some common parameters in a configuration file that is read at each invocation. There are two configuration files - the global /etc/s5.conf and a per-user .s5.conf in the user's home directory. The global file is read first; the per-user file may override any of its settings. The configuration file has simple shell-like syntax; its purpose is merely to optionally set some variables. Lines starting with the ``#'' character are ignored as comments. The variables that affect the operation of s5 are: S5_DIR The top-level directory containing all the templates; overridden by the command-line -d option. Default: /usr/share/s5 S5_TEMPLATE The name of the template to use, a subdirectory within S5_DIR; overridden by the command-line -t option. Default: s5-blank THE CHECKSUMS FILE
The s5 utility stores the checksums of blank S5 presentations into a file named s5-checksums.txt into the presentation directory. This is a simple text file with lines containing of a keyword and values. The keywords that the s5 utility currently generates and parses are as fol- lows: CKSUM_CMD checksum-program The name of the checksum program to use; the default is cksum(1). CKSUM_ARGS [[argument...]] The arguments (if any) passed to the checksum program as defined by the CKSUM_CMD line. The default is an empty string, no arguments passed. FILE filename The name of the file that the following CKSUM line refers to. CKSUM checksum-line-text The output of the checksum command as specified by CKSUM_CMD and CKSUM_ARGS conflated into a single line. EXAMPLES
Start a brand new presentation: s5 blank ~/txt/openfest/2006/gnupg-pres cd ~/txt/openfest/2006/gnupg-pres/ mv s5-blank/ gnupg/ Verify if any of the S5 files in the presentation have been modified: s5 cksum gnupg/ Do the same, but display verbose information about the lines read from the checksums file and the files verified: s5 -v cksum gnupg/ Update the S5 presentation files after installing a new system-wide version of the S5 template: s5 update gnupg/ Store the checksums of the S5 template files (not the real files in the presentation directory!) into the s5-checksums.txt file in the gnupg/ directory; this is actually redundant, as it is done as part of the s5 blank invocation: s5 mksum gnupg/ SEE ALSO
The home page of the Simple Standards-based Slide Show System: http://www.meyerweb.com/eric/tools/s5/ HISTORY
The Simple Standards-based Slide Show System was written by Eric Meyer based on earlier work by Tantek Celik. The s5 tool and this manual page were written by Peter Pentchev in 2008. AUTHORS
Eric Meyer <eric@meyerweb.com> Tantek Celik <tantek@tantek.com> Peter Pentchev <roam@ringlet.net> BSD
January 7, 2010 BSD
All times are GMT -4. The time now is 08:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy