Jump to content

Calling Unix Or Ms Excel Experts.........


Recommended Posts

Posted

i need small help bayya's.........
i have 2 csv files fileA and fileB...and each have single column "empId".
now i want to create a new file fileC which contatins all records from fileA which are not in fileB......

simple ga cheppalante fileA-fileB anna maata......so total ga fileA lo unna extra records anni kotha file lo ravali anna maata.....
i tried with "diff" command in unix but the data is creating like below..

4a5
> 100495
8a10
> 101873
17a20,21
> 10328
> 103310
19d22
< 104177
21d23
< 104576
26c28
< 105065
---

i want only data....madyalo unna junk antha theeseyali..is there any way to do it.......plz help...

Posted

[quote name='jamajacha' timestamp='1349811253' post='1302601805']
do you hav ms access ?
[/quote]
undi bayya.......i have ms access2007 ..... *<:( *<:( *<:(

Posted

import these two CSV files then write a SQLquery
should be simple

import file 1, import file 2.

select file1.col1, file2 col1 from file1 left join file2 on file1.col1 = file2.col1


this will give you all records that match and dont match.

file1 = table 1
file2 = table 2
where col1 is the common column in both tables

Posted

if you think access if heck and hell..

try for excel macro here..
[url="http://stackoverflow.com/questions/5387929/vba-macro-to-compare-all-cells-of-two-excel-files"]http://stackoverflow.com/questions/5387929/vba-macro-to-compare-all-cells-of-two-excel-files[/url]

Posted

source :[url="http://www.exceltip.com/st/Compare_two_worksheets_using_VBA_in_Microsoft_Excel/477.html"]http://www.exceltip.com/st/Compare_two_worksheets_using_VBA_in_Microsoft_Excel/477.html[/url]

[color=#000000][font=Arial, Helvetica, sans-serif][size=3]With the macro below it is possible to compare the content of two worksheets. [/size][/font][/color]
[color=#000000][font=Arial, Helvetica, sans-serif][size=3]The result is displayed in a new workbook listing all cell differences.[/size][/font][/color]
Sub CompareWorksheets(ws1 As Worksheet, ws2 As Worksheet)
Dim r As Long, c As Integer
Dim lr1 As Long, lr2 As Long, lc1 As Integer, lc2 As Integer
Dim maxR As Long, maxC As Integer, cf1 As String, cf2 As String
Dim rptWB As Workbook, DiffCount As Long
Application.ScreenUpdating = False
Application.StatusBar = "Creating the report..."
Set rptWB = Workbooks.Add
Application.DisplayAlerts = False
While Worksheets.Count > 1
Worksheets(2).Delete
Wend
Application.DisplayAlerts = True
With ws1.UsedRange
lr1 = .Rows.Count
lc1 = .Columns.Count
End With
With ws2.UsedRange
lr2 = .Rows.Count
lc2 = .Columns.Count
End With
maxR = lr1
maxC = lc1
If maxR < lr2 Then maxR = lr2
If maxC < lc2 Then maxC = lc2
DiffCount = 0
For c = 1 To maxC
Application.StatusBar = "Comparing cells " & Format(c / maxC, "0 %") & "..."
For r = 1 To maxR
cf1 = ""
cf2 = ""
On Error Resume Next
cf1 = ws1.Cells(r, c).FormulaLocal
cf2 = ws2.Cells(r, c).FormulaLocal
On Error GoTo 0
If cf1 <> cf2 Then
DiffCount = DiffCount + 1
Cells(r, c).Formula = "'" & cf1 & " <> " & cf2
End If
Next r
Next c
Application.StatusBar = "Formatting the report..."
With Range(Cells(1, 1), Cells(maxR, maxC))
.Interior.ColorIndex = 19
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
On Error Resume Next
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlHairline
End With
On Error GoTo 0
End With
Columns("A:IV").ColumnWidth = 20
rptWB.Saved = True
If DiffCount = 0 Then
rptWB.Close False
End If
Set rptWB = Nothing
Application.StatusBar = False
Application.ScreenUpdating = True
MsgBox DiffCount & " cells contain different formulas!", vbInformation, _
"Compare " & ws1.Name & " with " & ws2.Name
End Sub



[color=#000000][font=Arial, Helvetica, sans-serif][size=3]You just have to copy the two example procedures above and paste them into a normal module sheet in your workbook (you can't use the sheet modules). [/size][/font][/color]

[color=#000000][font=Arial, Helvetica, sans-serif][size=3]Open a workbook that contains two sheets you want to compare. [/size][/font][/color]
[color=#000000][font=Arial, Helvetica, sans-serif][size=3]Edit the sheet names used in the macro "TestCompareWorksheets" (or, if you are lazy, rename the sheets in the workbook). [/size][/font][/color]

[color=#000000][font=Arial, Helvetica, sans-serif][size=3]In Excel you press Alt+F8 to open the macro dialog box and run this macro: "TestCompareWorksheets". [/size][/font][/color]

[color=#000000][font=Arial, Helvetica, sans-serif][size=3]A more detailed description of this procedure is available here: [/size][/font][/color]
[color=#000000][font=Arial, Helvetica, sans-serif][size=3][url="http://www.erlandsendata.no/english/vba/howto.php"]http://www.erlandsen...h/vba/howto.php[/url][/size][/font][/color]

Posted

another brief description with illustrated examples..
[url="http://excelexperts.com/VBA-Tips-Compare-2-Data-Sets"]http://excelexperts.com/VBA-Tips-Compare-2-Data-Sets[/url]

Posted

COMM command try chey baaa ...


cat file1
1
2
3
9
10
8
6

cat file2
1
2
3
4
5
6
7


comm -23 file1 file2
9
10
8
6


COMM only works for sorted file to sort the file use below

cat file1 | sort > file11
cat file2 | sort > file22

FROM UNIX MAN PAGES - COMM



[b] SYNOPSIS[/b]
comm [OPTION]... FILE1 FILE2
[b] DESCRIPTION[/b]
Compare sorted files FILE1 and FILE2 line by line. With no options, produce three-column output. Column one contains lines unique to FILE1, column two contains lines unique to FILE2, and column three contains lines common to both files. -1 suppress lines unique to FILE1 -2 suppress lines unique to FILE2 -3 suppress lines that appear in both files

×
×
  • Create New...