Need a Script to check 3 csv files

Hi,
Can someone help me with the Power Shell script with the below requirements
1. Input file
2. Country file
3. Location File
I want to use my input file and compare the given Country file and Location File & then output should show that user validation check is completed if user country and location are matched.
If any of the Country file or Location file is not matched, then the output file should give the result as Validation Check failed for the user.
Whenever you see a helpful reply, click on Vote As Helpful & click on Mark As Answer if a post answers your question.

Below are the 3 files which i want to use in Script
1. Input file contains below headers
User Display Name
SMTP Address
NTUserID
NTUserDomain
Location
Location Code
Country
Country Code
Telephone Number
2. Country approval list
Country
Country Code
3.Location and Status list
Location Code    Location Name    Status    Date
note: status contains either yes or no
I am trying to compare input file with 2nd file with Country or Country Code & 3rd file with location and status if everything matches.. i want the output like UserName and with a new column "Validation Success"
If it doesn't match then i want a new column and mention the reason if Location code is not matching or Status is No for that Location Code or Country if it not present in the 2nd file.
Hope i am able to convey my requirement
Whenever you see a helpful reply, click on Vote As Helpful & click on Mark As Answer if a post answers your question.

Similar Messages

  • Check CSV file name while uploading file?

    Hi All,
    I am uploading data from CSV file.. That part is working fine.
    Now i want to check CSV file name. Ex : CSV file name = W1234H4321AB.
    I want to check 6th letter, if 6th letter is eq 'H', i want to upload data otherwise should display some message.
    I tried by reading this attribute, but i declared this type as XSTRING, i checked value after using get_Attribute in  lv_datasouce. It contains some XSTRING value. How to get CSV file name??
    Cheers,
    Venkys.

    >
    Thomas Jung wrote:
    > >I want to check 6th letter, if 6th letter is eq 'H', i want to upload data otherwise should display some message.
    >
    > Everything that you have been told about using the filename property of the FileUpload is correct. However you should note that the filename will not be available until after the file has already been upload to the server. So you can't stop the fileUpload based upon a check of the filename - its too late and the upload has already occured.
    yeah that is true. but is there anyway to check it otherwise.
    or we need to wait for something in coming versions 7.3 or 7.4.

  • How export to csv work in safari browser? In my application export to csv open like a raw data in new tab. But other browsers working great!. Need to open in a csv file or save it as a csv file.

    How export to csv work in safari browser?
    In my application export to csv open like a raw data in new tab.
    But other browsers working great!.
    Need to open in a csv file or save it as a csv file.
    Please suggest me. Thank you in advance!.

    Hi Adrian,
    Why don't you try any another software for opening CSV files then Notepad ? According to my experience, you can use these softwares to open an CSV files and they are:-
    Microsoft Excel
    Open Office Calc
    Google Docs
    Also there is an additional tool available known as CSV viewer. You may try this, download it from here http://www.csvviewer.com/
    I've never used Notepad for opening CSV files, because sometimes it contains some symbols which are not not at all compatibile with Notepad.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Running a script in an .csv file

    I have an excel .csv I need to apply formatting to each time it is opened.
    The file has 1 query to pull data from a .txt file
    Take the data and display in appropriate columns
    Use a macro ( or script ), to check data in columns
    Display query data in a cell to be read by another program looking for data in that cell

    This is a job for Excel and not for scripting. Post your request in the Office Excel forum. They will help you learn Excel.
    If you want to do this programtically then you will need to start by learning a scripting language.  I recommend PowerShell.
    Most formatting of documents is done with a template.  This would be applied when creating your document.
    Start by learning Excel then look into PowerShell.  You can alos look int he repository for samples of using Excel with PowerShell.
    http://gallery.technet.microsoft.com/
    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    ¯\_(ツ)_/¯

  • Need a script to check the version of Office365 Pro Plus to push our office updates

    I need a script that could check the version of office365 pro plus e.g ( 15.0.4711.1002) and if it doesn't exists on users machine than to deploy a latest version from a network location
    I have an XML which works fine with downloading and even when deploying onto test machine but would not work on users which has an encrypted HDD and windows firewall turned on. the machine don't seem to pull the updates from Microsoft hence why wanted to
    deploy the updates through a GPO start-up script
    Currently the script would run the setup countless times without checking version and exiting the process if the version found. I hope the information given is adequate. Thanks

    Frederik, After some tweaking and testing i was able to get it working, I haven't tested it via GPO as a startup script but standalone it is doing what i was after. I cant thank you enough for helping me on this as i had lost hope after days worth of intense
    searching
    Change that i had to apply ( space in a network path
    was causing a "path not found error", Had to rename the "Office365 update" and update the path in Customconfig.xml  or any other location that was pointing to "office365 update" )
     set DeployServer=\\contoso\c2r\Office365 update\
    REM Set ConfigFile to the configuration file to be used for
    deployment (required)
    set ConfigFile=\\contoso\c2r\Office365 update\Customconfig.xml
    REM Set LogLocation to a central directory to collect script
    log files (install log files are set in XML file).
    set LogLocation=C:\AppData\Local\Temp

  • Tablespace getting full quite often [cannot extend tbs], need a script to add data files on reaching the threshold!!

    Good morning Techies,
    I have a OBIEE environment where developers work on continuous data loads and the tablespaces are filled up quite often throwing cannot extend.
    I have a request from the customer to generate some script or automatic adding up of datafiles.
    Can someone here help with the ways of automizing or easing this situation through some script where it ask the users for the path and DB file size etc and creates a datafile with the inputs.
    Or advise any other ways to handle the situation.
    Regards,
    RanG

    Oracle does not but you can write your own job to execute when you reach certain threshold. You can also do this in a GRID so whenever the metric threshold reached, it executes your procedure. Make sure you check your file system space before adding a datafile.
    With BIGFILE tablespace, you might need to change your backup policies.
    Check these link as well:
    tablespace - Can oracle tablesspaces automatically add smallfile datafiles? - Stack Overflow
    Can Oracle Create New Datafile Automatically?

  • Need a script to delete user files and run on logout.

    Hi folks!
    I'm a total Mac novice so forgive me if I'm vague on anything here. I work in a library and we have recently acquired an iMac running Mountain Lion. The unit is primarily for use by Visually Impaired users however sighted folks can use it as well.
    What I need is something that will delete any files created/downloaded by the sighted users but that will not delete anyone else's files. I tried just using the Guest Account however that also deletes all the system preferences for that account including the dock setup which I need to stay the same.
    If possible I would like this to run on logout.
    For additional points anyone who can also find me something that will run automatically when the users sign in and will sign them out after 30 minutes would super spectacularly awesome.
    Thanks people!

    That being said, if you you still really want to do this you can create a logout hook and write a shell script to remove the files.  See "About Daemons and Services", Appendix B on writing a logout hook.
    But a far easier way is to create Account's login item that will cause a shell script to be launched to delete the files.  You can encapsulate the shell script so it runs as an application that can be added to the Login Items.  One such encapsulator is Platypus.
    Note, rather than delete them, if you want to ensure all the specific plists have specific settings, then create a master set of them and copy the master set into the Preferences directory (being careful to observe ownership and permissions settings of course).

  • Need a Script to check Database backup chain for revovery

    Dear All,
    any having a handy script to check database backup chain ,
    Database A --> Full backup  -- Diff -- log1 --Log 2 ...... and scan through the files to validate if we can recover the database using the avaiable backups.
    Regards
    Sufian
    Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.

    You can use below TSQL
    set nocount on
    go
    if exists ( select name from tempdb..sysobjects where name like '#DatabasesBackupsStatus%')
    drop table #DatabasesBackupsStatus
    GO
    create table #DatabasesBackupsStatus
    ServerName varchar(100) null,
    DBName varchar(100) null,
    RecoveryModel varchar(100) null,
    LastFullbackup datetime null,
    days_since_Lastfullbackup int null,
    days_since_Lastdiffbackup int null,
    HOURS_since_LastLogbackup int,
    DBStatus varchar (100) null,
    FullBackupLocation varchar(1000) null,
    MEDIASET INT,
    JobOwner varchar(100) null
    Go
    insert into #DatabasesBackupsStatus(ServerName,DBName)
    select convert(varchar,serverproperty('ServerName')),a.name
    from master.dbo.sysdatabases a
    where a.name <> 'tempdb'
    update #DatabasesBackupsStatus
    set LastFullbackup=b.backup_start_date,
    days_since_Lastfullbackup=datediff(dd,b.backup_start_date,getdate()),
    MEDIASET=b.media_set_id
    from #DatabasesBackupsStatus a,(select database_name,MAX(media_set_id)media_set_id,max(backup_start_date) backup_start_date
    from msdb..backupset where type='D' group by database_name)b
    where a.DBName=b.database_name
    update #DatabasesBackupsStatus
    set RecoveryModel=convert(sysname,DatabasePropertyEx(DBName,'Recovery'))
    update #DatabasesBackupsStatus
    set DBStatus=convert(sysname,DatabasePropertyEx(DBName,'Status'))
    update d
    set d.FullBackupLocation=b.physical_device_name
    from #DatabasesBackupsStatus d , msdb..backupmediafamily b
    where d.MEDIASET =b.media_set_id
    update d
    set d.days_since_Lastdiffbackup=datediff(dd,b.backup_finish_date,getdate())
    from #DatabasesBackupsStatus d , (select database_name,max(backup_finish_date) backup_finish_date
    from msdb..backupset where type ='I' group by database_name) b
    where d.DBName = b.database_name
    update d
    set d.JobOwner=b.[user_name]
    from #DatabasesBackupsStatus d , msdb..backupset b
    where d.MEDIASET = b.media_set_id
    update d
    set d.HOURS_since_LastLogbackup=datediff(hh,b.backup_finish_date,getdate())
    from #DatabasesBackupsStatus d , (select database_name,max(backup_finish_date) backup_finish_date
    from msdb..backupset where type ='L' group by database_name) b
    where d.DBName = b.database_name
    AND d.RecoveryModel != 'SIMPLE'
    Go
    select * from #DatabasesBackupsStatus
    Go
    drop table #DatabasesBackupsStatus
    Please Mark This As Answer if it solved your issue 
    Please Mark This As Helpful if it helps to solve your issue
    Thanks,
    Shashikant

  • Need help with query from .csv file

    I am trying to import a csv file with only 1 column in it.
    The column will only contain a 9 digit ID number. I want to read
    the file then use the contents to query a table to get the names
    and other information and display it. Here is what I have so far:
    <cffile action="read" file="#form.FiletoUpload#"
    variable="csvfile">
    <cfloop index="index" list="#csvfile#">
    <cfquery name="massimport" datasource="data1">
    SELECT * FROM IDTable
    WHERE CardNumber = ('#csvfile#')
    </cfquery>
    </cfloop>
    <cfoutput>#Name# #ID# #Site#</cfoutput>
    I get no errors but I am not getting any results. Just a
    blank page. Does anyone know how to query directly from a csv
    import? Thanks.

    You need to convert your file to a list somehow. Not sure if
    this is the most efficient way but, you can use the cfhttp tag to
    produce a query. Then your where clause becomes,
    where cardnumber in (#quotedvaluelist(query.column)#)
    and you won't need a loop.

  • Need to load 2.4GB CSV file

    I would like to load a portion of a 2.4gb csv file to a 10g table. The file is too large to open in notepad or excel. How can I load a portion of this file to a table?
    Can I load the data into a generic table(do not define columns). Let the file dictate the colums. Is that possible? I'm not sure of the layout of the file because it is too large.
    Thanks
    Steve

    Unfortunately DOS doesn't have the stream tools available in shell programming, but you can install cygwin and use line editors or stream editors to perform this task, you could use the head or tail command or sed or grep to gather a few lines, redirect the output to a sample file.
    You cannot have a partially or non defined table in Oracle, but once you have the sqlldr to perform the table load, you can create an external table based on the file and you can query just a row subset. In order for you to create an external table based on the sqlloader controlfile is by means of the external_table=generate_only clause of the sqlldr executable.

  • Need  Shell Script  for picking the files

    Hi,
        I want to write a shell script for piking the files in a sequence order (according to filename with time stamp)  from the sorce FTP server ..
                     Requirement is  in the source directory I'm getting files (Jain_1.xml  , Jjain_2.xml, Jain_3.xml .. ect..)  at  present my file adapter is picking all the files at a time  but  i want to pick  one by one... that to first i want to Jain_1.xml  after finish the processing of the file then only my file adapter should  pick the next file ( Jain_2.xml )  .
                  so..  all the forum mates suggest me to write a shell script..  but where  i have to write the s hell script. and where i have to deploy this script.... my Xi is running on UNIX ... so please sugest me  the procedure ...
    Regards
    Jain

    Hi,
    Why dont you use the option EOIO in which files will be picked up in order and will be proccessed in sequence....one after another....
    Regards,
    Sreeni.

  • Flash professional + action script to check existing file

    Hello Guru:
    I am using Flash professional with action script 3.
    Please recommended me how to check if existing file in drive c: exist or not.
    Thanks in advance.

    use:
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,errorF );
    loader.load(new URLRequest("file://c:/CaptivateLog.txt"));
    function errorF(e:IOErrorEvent):void{
    trace(IOErrorEvent.IO_ERROR);
    trace("file not found");
    // catch error
    p.s.  please mark helpful/correct responses, if there are any.

  • Need to include header in csv file while using GUI_DOWNLOAD

    Hi,
    Iam using GUI_DOWNLOAD for downloading certain texts,its working fine.now i need to include the header(i'e) some text say 'This is a error file'at the top.how can i do this?

    REPORT  ZTEST12347                              .
    DATA: BEGIN OF ITAB OCCURS 0,
            VBELN LIKE VBAK-VBELN,
            POSNR LIKE VBAP-POSNR,
          END OF ITAB.
    SELECT VBELN
           POSNR
          FROM VBAP
          UP TO 20 ROWS
          INTO TABLE ITAB.
    DATA: IT_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE.
    IT_LINE-TDLINE = 'this is error file'.
    append it_line.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                = 'C:test.txt'
      TABLES
        DATA_TAB                = IT_LINE
      EXCEPTIONS
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION  = 20
        CONTROL_FLUSH_ERROR     = 21
        OTHERS                  = 22.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                = 'C:test.txt'
        APPEND                  = 'X'
      TABLES
        DATA_TAB                = ITAB
      EXCEPTIONS
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION  = 20
        CONTROL_FLUSH_ERROR     = 21
        OTHERS                  = 22.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Need a bat script to check Server status remotly.

    Hi,
    I need bat script to check server status remotly (Ping) for multiple servers. It should generate a txt file for result.
    Thanks.

    Hi Ravi,
    To ping multiple computers and generate report cia cmd, please refer to the script below, the "fnm" is computer name list and the "lnm" is the result, and you can save the script below as .bat file:
    @echo off
    set fnm=d:\test1\computers.txt
    set lnm=d:\test1\ping.txt
    if exist %fnm% goto Label1
    echo.
    echo Cannot find %fnm%
    echo.
    Pause
    goto :eof
    :Label1
    echo PingTest STARTED on %date% at %time% > %lnm%
    echo ================================================= >> %lnm%
    echo.
    for /f %%i in (%fnm%) do call :Sub %%i
    echo.
    echo ================================================= >> %lnm%
    echo PingTest ENDED on %date% at %time% >> %lnm%
    echo ... now exiting
    goto :eof
    :Sub
    echo Testing %1
    set state=alive
    ping -n 1 %1
    if errorlevel 1 set state=dead
    echo %1 is %state% >> %lnm%
    Refer to:
    Explain the Batch script to ping multiple computers
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Need to download only in .csv format

    hi
    i need to download only in .csv file
    if any one gives the other format file then it must change to.csv onthe selectionscreen itself and then it is to be executed
    i mean the last 3 digits to be changed ' csv'
    urgent
    regards
    sachin

    Hi
    Check this code, maybe is helpful
        clear it_tabla2[].
        call function 'SAP_CONVERT_TO_CSV_FORMAT'
             exporting
                  i_field_seperator    = ';'
             tables
                  i_tab_sap_data       = empleados
             changing
                  i_tab_converted_data = it_tabla2
             exceptions
                  conversion_failed    = 1
                  others               = 2.
        call function 'WS_DOWNLOAD'
             exporting
                  filename                = emplea
    *              filetype                = 'DAT'
    *              mode                    = ' '
                  filetype_no_change      = 'X'
    *              item                    = 'Archivo de Empleados'
             tables
                  data_tab                = it_tabla2[]
             exceptions
                  invalid_filesize        = 1
                  invalid_table_width     = 2
                  invalid_type            = 3
                  no_batch                = 4
                  unknown_error           = 5
                  gui_refuse_filetransfer = 6
                  customer_error          = 7
                  others                  = 8.
    Regards
    Gregory

Maybe you are looking for