Windows 10: Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell)

Discus and support Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell) in AntiVirus, Firewalls and System Security to solve the problem; Basically what's happening is that I have two files, one with a list of allowed users and another list of users that are actually on the desktop. What... Discussion in 'AntiVirus, Firewalls and System Security' started by BassoftheC, Dec 25, 2018.

  1. Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell)


    Basically what's happening is that I have two files, one with a list of allowed users and another list of users that are actually on the desktop. What I'm trying to do is use a for loop to grab each name in the AllowedUsers.txt file, and use Select-String to find any names that match and delete them from the original Users.txt (with the list of users actually on the desktop). The end goal is to have a list of users that aren't allowed on the desktop left in the Users.txt file, where I can then for loop through once again and simply delete those users through command line.


    Unfortunately, I have been unable to get this to work as I don't fully grasp how Select-String or for loops work, but any help writing the script would be greatly appreciated.

    :)
     
    BassoftheC, Dec 25, 2018
    #1

  2. ordering strings alphanumerically

    You don't loop it, it does via .Sort(IComparer). In my example, it would like like...
    Code: List<string> list = new List<string>(); list.Add("2"); list.Add("1"); list.Add("0"); //sort it OffsetLengthPairComparer comparer = new OffsetLengthPairComparer(); list.Sort(comparer);[/quote] Obviously my comparer doesn't work for strings because it is for a custom type but, you get the idea.
     
    FordGT90Concept, Dec 25, 2018
    #2
  3. dalchina Win User
    Searching for documents with a specific text string


    Assuming search indexing is working properly: note that File Explorer search should behave as you expect, if settings correct; Cortana search, on the other hand, will ONLY find indexed documents, and there are options to click on to select searching Apps, Documents, Music etc. (see Filters in Cortana's Window, top right)

    Note settings that could stop this happening:

    Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell) [​IMG]

    - per file

    Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell) [​IMG]

    - per file type
     
    dalchina, Dec 25, 2018
    #3
  4. Kreij Win User

    Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell)

    Strings and Linked lists in C++

    How are you telling it to display the separated string?
    Could you inadvertantly be just displaying at the first string in the list and they are actaully all there?

    Did you get my PM about converting to c-string and tokenizing?
     
    Kreij, Dec 25, 2018
    #4
Thema:

Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell)

Loading...
  1. Deleting Lines in a Text File Given Strings From Another File Using Set-String (Powershell) - Similar Threads - Deleting Lines Text

  2. Control Key Usage for Text String

    in Windows 10 Software and Apps
    Control Key Usage for Text String: To set up a custom keyboard shortcut on Windows 11, please follow the steps below:> Open the Start menu and select the Settings app.> Click on the Time & language tab.> Select the Language & region navigation option.> Click the … button for your basic typing pack listed in...
  3. String OBJ_STATUS_DISKSPACE_SPACE was not found in string table

    in Windows 10 Gaming
    String OBJ_STATUS_DISKSPACE_SPACE was not found in string table: I'm trying to complete the installation of the BS-240 clinical chemistry analyzer that is to be connected to a Windows 10 computer. Whenever I run the 'setup.exe' file to start the installation, I see this error pop up immediately - String OBJ_STATUS_DISKSPACE_SPACE was not...
  4. shift key deletes text and/or creates a string of symbols or opens another window entirely

    in Windows 10 Drivers and Hardware
    shift key deletes text and/or creates a string of symbols or opens another window entirely: whenever i press my left shift key, it either creates a string of symbols, deletes whatever i just typed, or toggles between tabs in chrome. the right shift key will also delete whatever i just typed, go to the next line as if its the enter key, or turns on caps lock. i'm...
  5. Searching for duplicate text strings in File Explorer - Windows 10

    in Windows 10 Network and Sharing
    Searching for duplicate text strings in File Explorer - Windows 10: I've several external data drives with many, many files and directories. Many files are duplicated and I would like to eliminate the duplicates. The syntax for the duplicates is, for example: "file name n.docx" where n is a number, usually 1, 2 or 3. Using the community...
  6. String of photos in JPG files

    in Windows 10 Network and Sharing
    String of photos in JPG files: Hello, When I try to upload one Document JPG photo a string of my oher photos are attached. I had originally sent these photos from my iPhone to email and saved to documents as JPGs. I notice others have had this problem. Has anyone found a solution to this problem and...
  7. searching for a specific string in File Explorer

    in Windows 10 Network and Sharing
    searching for a specific string in File Explorer: I used to have lots of MP3 files on my network drive that began with "01)." or "02)." etc. I have converted most of them to begin "01" or "02" etc. but now I would like to do a search or "01)." to find any I may have missed but when I search for that it gives me all...
  8. Looking for a Text to string application

    in Windows 10 Software and Apps
    Looking for a Text to string application: Hello I'm looking for an application or a web site that I will use to record good quality mp3 file from a string. Type a text and the output is a spoken mp3 file I was using few years ago AT&T application, but this site is down now Martin 26503
  9. String with spaces in set /p (batch file)

    in Windows 10 Software and Apps
    String with spaces in set /p (batch file): Hi! I would like to let a user type in things with spaces in set /p. This is the code I currently have that does not work: Code: :newdoc2 cls echo What do you want to say? set saynew=%randomnum% set /p saynew= if %saynew% == %randomnum% goto newdoc2 echo "%saynew%"...
  10. Powershell string parsing

    in Windows 10 Support
    Powershell string parsing: Lets say I have a string with several columns separated by spaces. The number of spaces and the data in each column are unknown. How would you grab what's in col3 using PowerShell? I know how I would do it with Awk, but that won't necessarily be available to me. col1 col2...