01-06-2012
Problem while working with multiple files
Dear friends,
I am working with two files named g1.txt and g2.txt....g1.txt is my main file in which it contains following data
#per_no permissionname permission command
1|HideCDrive, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f ,
2|HideRunButton, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,
3|DisableControlPanel, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispCPL /t REG_DWORD /d 1 /f ,
4|AddMycomputerIexploreandMynetworkplaceMyDocumentIcononDesktop, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explore\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f ,
5|RestrictUserToRuncmd, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 1 /f ,
6|RemoveAdd/RemoveProgramsprograms, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall" /v NoAddRemovePrograms /t REG_DWORD /d1 /f ,
I have another file say g2.txt in that some of the data fetched from g1.txt and content of that file look like this.
HideCDrive,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f ,
HideRunButton,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,
DisableControlPanel,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispCPL /t REG_DWORD /d 1 /f ,
AddMycomputerIexploreandMynetworkplaceMyDocumentIcononDesktop,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explore\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f ,
RestrictUserToRuncmd,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 1 /f ,
RemoveAdd/RemoveProgramsprograms,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall" /v NoAddRemovePrograms /t REG_DWORD /d1 /f ,
I want to create a script in which user enters permission numbers say 1,2,3 ....it will take permission number one by one say 1 ,then it will take the respective permission command grom g1.txt file....i.e "REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDrives /t REG_DWORD /d 4 /f , " .....i want to check that this permission command is exist in g2.txt file or not. If it exist then delete that permission name as well as permission command....
at this time my g2.txt file look like this.
HideRunButton,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoClose /t REG_DWORD /d 1 /f ,
DisableControlPanel,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispCPL /t REG_DWORD /d 1 /f ,
AddMycomputerIexploreandMynetworkplaceMyDocumentIcononDesktop,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explore\HideDesktopIcons\NewStartPanel" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f ,
RestrictUserToRuncmd,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 1 /f ,
RemoveAdd/RemoveProgramsprograms,
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Uninstall" /v NoAddRemovePrograms /t REG_DWORD /d1 /f ,
#-----------------------------------------------------------------------------------------
How can i do that? Any help would be appreciated....
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello
when I try to run rm on multiple files I have problem to delete files with space.
I have this command :
find . -name "*.cmd" | xargs \rm -f
it doing the work fine but when it comes across files with spaces like : "my foo file.cmd"
it refuse to delete it
why? (1 Reply)
Discussion started by: umen
1 Replies
2. UNIX for Dummies Questions & Answers
I have a couple of things I got stuck on
1)
I have a text file containing 25k search string that I need to search against compressed file. I have used this command but somehow it doesn't seems to use all the search terms.
I have put one search string per line in the txt file (I clean up... (2 Replies)
Discussion started by: m00
2 Replies
3. Shell Programming and Scripting
Hi,
I have gone through the other related post but are of no help for me
I am sending multiple files as attachement.
The first file comes fine as an attachement but the other files are coming as binary.
For people with older version of email software they can see all attachements but... (1 Reply)
Discussion started by: pinnacle
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I'd like to process multiple files. For example:
file1.txt
file2.txt
file3.txt
Each file contains several lines of data. I want to extract a piece of data and output it to a new file.
file1.txt ----> newfile1.txt
file2.txt ----> newfile2.txt
file3.txt ----> newfile3.txt
Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies
5. Programming
Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine.
So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files.
My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies
6. Shell Programming and Scripting
I want to concatenate multiple files recursively from sub-directories intoone file in Linux.
I saved the following script as script.sh in $HOME/testing1 where I have several subdirectories and .txt files into them. I ran script.sh from the command prompt of $HOME/testing1 as ./script.sh. But it... (3 Replies)
Discussion started by: raj284
3 Replies
7. UNIX for Dummies Questions & Answers
I'm baffled..... the system I work on creates files every Mon-Friday
I'm trying to delete all files older than 30 days old from a Unix prompt, the command I'm using is:
find /directory/ -mtime +30 -exec rm {} \;
however it returns /directory/filename: 644 mode ? (y/n) for every file! ... (1 Reply)
Discussion started by: bquattrone
1 Replies
8. UNIX for Dummies Questions & Answers
Hi,
Can any gurus advise why :p is not working on my vi?
When editing multiple files, :n works and it takes me the next file, but :p which is supposed to take me back to the previous file does not work.
Please advise. Thanks in advance. (2 Replies)
Discussion started by: newbie_01
2 Replies
9. UNIX for Dummies Questions & Answers
How can I run the following command on multiple files and print out the corresponding multiple files.
perl script.pl genome.gff 1.txt > 1.gff
However, there are multiples files of 1.txt, from 1----100.txt
Thank you so much.
No duplicate posting! Continue here. (0 Replies)
Discussion started by: grace_shen
0 Replies
10. Shell Programming and Scripting
How can I Run one script on multiple files and print out multiple files.
FOR EXAMPLE
i want to run script.pl on 100 files named 1.txt ....100.txt under same directory and print out corresponding file 1.gff ....100.gff.THANKS (4 Replies)
Discussion started by: grace_shen
4 Replies