Search Results

Search found 41379 results on 1656 pages for 'command line'.

Page 20/1656 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Is there a command-line utility app which can find a specific block of lines in a text file, and replace it?

    - by fred.bear
    UPDATE (see end of question) The text "search and replace" utility programs I've seen, seem to only search on a line-by-line basis... Is there a command-line tool which can locate one block of lines (in a text file), and replace it with another block of lines.? For example: Does the test file file contain this exact group of lines: 'Twas brillig, and the slithy toves Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. 'Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!' I want this, so that I can replace multiple lines of text in a file and know I'm not overwriting the wrong lines. I would never replace "The Jabberwocky" (Lewis Carroll), but it makes a novel example :) UPDATE: ..(sub-update) My following comment about reasons when not use sed are only in the context of; don't push any tool too far beyond its design intent (I use sed quite often, and consider it to be invaluable.) I just now found an interesting web page about sed and when not to use it. So, because of all the sed answers, I"ll post the link.. it is part of the sed FAQ on sourceforge Also, I'm pretty sure there is some way diff can do the job of locating the block of text (once it's located, the replacement is quite straight foward; using head and tail) ... 'diff' dumps all the necessary data, but I haven't yet worked out how to filter it , ... (I'm still working on it)

    Read the article

  • Reading text files line by line, with exact offset/position reporting

    - by Benjamin Podszun
    Hi. My simple requirement: Reading a huge ( a million) line test file (For this example assume it's a CSV of some sorts) and keeping a reference to the beginning of that line for faster lookup in the future (read a line, starting at X). I tried the naive and easy way first, using a StreamWriter and accessing the underlying BaseStream.Position. Unfortunately that doesn't work as I intended: Given a file containing the following Foo Bar Baz Bla Fasel and this very simple code using (var sr = new StreamReader(@"C:\Temp\LineTest.txt")) { string line; long pos = sr.BaseStream.Position; while ((line = sr.ReadLine()) != null) { Console.Write("{0:d3} ", pos); Console.WriteLine(line); pos = sr.BaseStream.Position; } } the output is: 000 Foo 025 Bar 025 Baz 025 Bla 025 Fasel I can imagine that the stream is trying to be helpful/efficient and probably reads in (big) chunks whenever new data is necessary. For me this is bad.. The question, finally: Any way to get the (byte, char) offset while reading a file line by line without using a basic Stream and messing with \r \n \r\n and string encoding etc. manually? Not a big deal, really, I just don't like to build things that might exist already..

    Read the article

  • Distributing a custom command line tool to enterprise servers

    - by Jeremy Baker
    I've been tasked with building a command line tool that we will be providing to our enterprise customers so that they can use the API to upload data to our platform. The API works with standard cURL requests, so I can do most of the basic functionality with simple bash scripting, although I would like to provide something that is solid and really makes it easy for them to use and I don't know what I don't know. It's been a good 8 years since I've really done any serious sysadmin work. Most of the good tools I use these days are written in Ruby or Python and have a standard distribution process (Gems, for example). However, I know rhel and other platforms have their own package managers. Finally, the question: In today's day and age, what language / distribution method should I consider in order to cover the widest range of platforms without having to build completely different versions for each platform? I'd also love any general feedback you have about building similar projects, or links to projects that you think do a good job of this now and have open source code that I could read. Thanks in advance!

    Read the article

  • bash pipe construct to prepend something to the stdoutput of previous command

    - by AndreasT
    I want to use sendmail to send me stuff and want to do it in a oneliner. echo "mail content" | sendmail emailataddres.com Sends it without subject. The subject line must come before the Mail content, so I am looking for something along the lines of: echo "mail content" | prepend "Subject: All that matters" | sendmail emailataddres.com sed and awk tend to be really awkward to use and remember. EDIT:Just to clarify: echo "Mail content" is just an illustrating example. I need to be able to prepend stuff to stdout streams from any source. e.g.: ifconfig, zcat, etc..

    Read the article

  • "Access is Denied" when executing application from Command Prompt

    - by xpda
    Today when I tried to run an old DOS utility from the XP Command prompt, I got the message "Access is Denied." Then I found that most of the DOS utilities would not run, even though I have "full control" over them. They worked just fine a few weeks ago, and I have not made any OS changes other than Windows Upgrades. Then I tried running edlin.exe and edit.com from the Windows\system32 folder. Same result - "Access is Denied." I tried running these applications from Windows Explorer and got the message "Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item." I am logged in as a member of Administrators and have full control over these files. I tried logging in as THE Administrator, with no change. I checked the security settings on the files, and have full control over all of them. I have tried copying the files to different drives, booting in safe mode, and running without antivirus and firewall, all with no change. Does anybody know what could cause this?

    Read the article

  • Power Shell does not like command

    - by Campo
    Any ideas what I did wrong here? I copied this script from a tutorial and get this error.... PS C:\Windows\system32> Get-Service | Where-Object ($_.status -eq "running") Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert value "False" to type "System.Management.Automation .ScriptBlock". Error: "Invalid cast from 'System.Boolean' to 'System.Management.Automation.ScriptBlock'." At line:1 char:27 + Get-Service | Where-Object <<<< ($_.status -eq "running") + CategoryInfo : InvalidArgument: (:) [Where-Object], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WhereObjectCommand

    Read the article

  • How to perform this Windows 7 permissions change on many files via GUI or command line

    - by hippietrail
    After using my external hard drive on another Windows 7 computer to tweak photos with Windows Live Photo Gallery then upload them to Facebook I found the modified images were now not visible on the original Windows 7 computer. I'm not sure if the things I tried to get it working subsequently changed anything, but I do know this is the sequence of actions that makes the permissions of the modified files match those of the unmodified files: Right click on broken image file, select "Properties" On the "Security" tab press the "Advanced" button In the "Permissions" tab press the "Continue" button with the shield icon on it Tick the box marked "Include inheritable permissions from this object's parent Click the "Remove" button to remove the only current entry "Type: Allow, Name: Administrators (XYZ\Administrators), Permission: Full control, Inherited From: OK on the "Permissions" tab. OK on the "Security" tab. Now this same procedure does not work at the folder level. It results in "access denied" dialogs. I'm looking for some way to perform this exact modification on all the images I edited on the other computer. I'm happy to use the Windows GUI in Explorer or any other included tools. I'm happy to use the Windows command line. I'd prefer not to use a third-party tool since I'd have to be satisfied it's not doing anything else. I'm not looking for a different way to change permissions to other settings to make an external drive full of photos editable on multiple computers. At least not in this question.

    Read the article

  • Collision of dot and line in 2D space

    - by Anderiel
    So i'm trying to make my first game on android. The thing is i have a small moving ball and i want it to bounce from a line that i drew. For that i need to find if the x,y of the ball are also coordinates of one dot from the line. I tried to implement these equations about lines x=a1 + t*u1 y=a2 + t*u2 = (x-a1)/u1=(y-a2)/u2 (t=t which has to be if the point is on the line) where x and y are the coordinates im testing, dot[a1,a2] is a dot that is on the line and u(u1,u2) is the vector of the line. heres the code: public boolean Collided() { float u1 =Math.abs(Math.round(begin_X)-Math.round(end_X)); float u2 =Math.abs(Math.round(begin_Y)-Math.round(end_Y)); float t_x =Math.round((elect_X - begin_X)/u1); float t_y =Math.round((elect_Y - begin_Y)/u2); if(t_x==t_y) { return true; } else { return false; } } points [begin_X,end_X] and [begin_Y,end_Y] are the two points from the line and [elect_X,elect_Y] are the coordinates of the ball theoreticaly it should work, but in the reality the ball most of the time just goes straigth through the line or bounces somewhere else where it shouldnt

    Read the article

  • Draw a line in crystal report

    - by Aniruddha
    I want to draw a line in Crystal report. I can do that from a sub-menu but this line I need to draw in a Group section Field object with a background color property set to some color. So whenever I draw a line it gets overlapped by this FieldObject. How can I make sure that line would be visible over the background color of object?

    Read the article

  • AS3 change lineStyle of existing line

    - by Ozzy
    Hi all im drawing a line from 0,0 to 100,100 im using this to modify the linestyle: draw_line.graphics.lineStyle(1, 0xFF0000); That line is now of 1 thickness. Is there anyway i can change the thickness of the line to say 10, but without redrawing the line?

    Read the article

  • Custom Control for Line

    - by Hamid
    I want to design a custom Control for Line (vertical or horizontal line) basic usercontrol is rectangle and not suitable for line what s your idea about line control?

    Read the article

  • I am trying to zip files individually, but the file type is unknown

    - by Jason Mander
    I am trying to zip some files with an unknown file type individually. I am using the following code in a batch script to do that: @ECHO OFF FOR %%A IN (bestbuy*nat*component.cpi*) DO "C:\Program Files\7-Zip\7z.exe" a -mx9 -m0=lzma2:d256m "%%~nA.7z" "%%A" The code will compress files individually ONLY if the file has an extension. Unfortunately the files that I have don't have any extension. In the code I am trying to zip files by doing a pattern match, the files are getting compressed into ONE file (which I do not want, I want each file compressed individually). Why does this code create separate zip files when the files have an extension (for example if I add .txt to the end of the files) and when there is no extension the code creates one zipped file. Can anyone please help me with the code to compress files with unknown file type so that each file gets compressed individually Your help would be greatly appreciated. Jason

    Read the article

  • How to solve this problem with a 'tuned' prompt in ZSH?

    - by Mnementh
    I have an adjusted prompt in my ZSH-configuration. Main feature is, that this prompt is colored red, so that I can easily it distinguish from the outputs of programs. My prompt is defined as follows: PROMPT=$'\e[0;31m%n@%m:%~> \e[0m' This works mostly fine, but sometimes my cursor switches to another position on tab-completion and some characters are left behind on the screen and mangle up the commandline. That is a little annoyance, but if someone knows a solution for this, I would appreciate it.

    Read the article

  • How do I start Chrome using a specified "user profile"?

    - by Danny Tuppeny
    I use the new built-in "Users" feature of Chrome to switch between Home/Work accounts easily. However, Chrome remembers the "last" user profile you had selected when launching new windows. This is a problem if I close down my "Home" profile last, because when I then click the Email shortcut on my taskbar, because it goes to mail.mycompany.com using my Home profile, and I'm not logged in. I'd like to change the shortcut to the company webmail to pass a switch that tells Chrome to always start as the "Default" user, regardless of the last one used. Note: I have tried user-data-dir, and this seems to do something very different, completely isolated from the Users functionality built in to Chrome. It's possible I'm using it wrong, but please test this before assuming it does the same thing and posting an answer ;-)

    Read the article

  • How do I create a scheduled task, via command line, which includes advanced options

    - by David
    I'm trying to create a scheduled task (in WinXP) which runs every 10 minutes, starting at 16:00:00 to 06:00:00, daily, from the command line. Currently, I can create a scheduled task which runs every 10 minutes, starting at 16:00:00, daily, by using the following command: SCHTASKS.EXE /CREATE /SC MINUTE /MO 10 /TN "Scheduled task name" /ST 16:00:00 /SD 01/01/2000 /TR task.bat /RU SYSTEM The question is, how do I modify the previous command so that it stops running at 06:00:00?

    Read the article

  • an emacs command to open a new instance of emacs

    - by RamyenHead
    How can I make a cross-platform emacs command that opens another instance of emacs with -q option? The reason why I need such a command is that it would be easy to modify the command to make it open another instance of emacs with -q and -l option so that the new instance loads an el file that I am editing with the old instance.

    Read the article

  • Exec Maven Plugin to Command Line

    - by mistercaste
    I have an application developed in NetBeans/Maven that can be started via command line with: mvn exec:exec "-Dexec.executable=C:\\Java\\jdk1.6.0_33\\bin\\java.exe" "-Dexec.args=-Dlog4j.properties=... -classpath %classpath com.xxx.MyLauncher" -Dexec.classpathScope=runtime -Dexec.workingdir= Now I need to run the application through the standard java command line method, like: java -Dlog4j.properties=... -jar myapp-1.2-SNAPSHOT.jar Unfortunately this does not work in the same manner, as I get the following exception: opencard.core.util.OpenCardPropertyLoadingException: property file not found Questions: What is the difference between launching applications with the Exec-Maven-plugin and the standard java execution on command line? Is there an easy way to convert a Maven execution script to a standard command line? How to run the application succesfully?

    Read the article

  • Running DOS command through C# just opens blank cmd window

    - by Mohit Deshpande
    I was trying to execute a command through C#, but when I run the following code, a blank cmd window just opens up. The code: string command = string.Format(@"adb install C:\Users\Mohit\Programming\Android_Workspace\{0}\bin\{0}.apk", appName); ProcessStartInfo cmdsi = new ProcessStartInfo("cmd.exe"); cmdsi.Arguments = command; Process cmd = Process.Start(cmdsi); What could be wrong? I am sure the syntax is right.

    Read the article

  • Execute multiple command lines with the same process using C#

    - by rima
    Hi according to my last question here I try to write a sql Editor or some thing like this,in this way I try to connect to CMD from C# and execute my command. now my problem is for example I connect to SQLPLUS after that I cant get SQLPLUS command,and the other resource I review don't satisfy me.Please help me how after I connected to Sqlplus ,I can a live my process to run my sql command? right now I use this code: //Create process System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); //strCommand is path and file name of command to run pProcess.StartInfo.FileName = strCommand; //strCommandParameters are parameters to pass to program pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false; //Set output of program to be written to process output stream pProcess.StartInfo.RedirectStandardOutput = true; //Optional pProcess.StartInfo.WorkingDirectory = strWorkingDirectory; //Start the process pProcess.Start(); //Get program output string strOutput = pProcess.StandardOutput.ReadToEnd(); //Wait for process to finish pProcess.WaitForExit(); but i customize it.I separate the initialize, i mean i just create process object one time,but I still have problem. to run the second command I use these codes for second time calling: pProcess.StartInfo.FileName = strCommand; //strCommandParameters are parameters to pass to program pProcess.StartInfo.Arguments = strCommandParameters; //Start the process pProcess.Start(); //Get program output string strOutput = pProcess.StandardOutput.ReadToEnd(); //Wait for process to finish pProcess.WaitForExit(); Thanks in advance

    Read the article

  • C# File.ReadAllLines not breaking on line feeds

    - by David Dickerson
    Hello, I have an application that I am building that needs to modify a configuration file. My problem is that I am not able to read the file in line by line. I keep geeting the the entire file as a single string. string ConfigTemplate = AEBuildsSPFolderName + "\Template_BuildReleaseScript.Config"; string[] fileSourceLines = File.ReadAllLines(ConfigTemplate, Encoding.Default); --Returns the entire file contents into the first array element. using (StreamReader reader = new StreamReader(ConfigTemplate)) { string line; while ((line = reader.ReadLine()) != null) --Returns the entire file contents into the first line read. Any idea of what I am doing wrong? Thanks, david

    Read the article

  • a selective dual command binding converter in WPF?

    - by Jippers
    I'll start off and say I am not using the MVVM pattern for my WPF app. Please forgive me. Right now I have a data template with two buttons, each binds to a different command on the CLR object this data template represents. Both use the same command parameter. Here's an example of the buttons. <Button x:Name="Button1" Command="{Binding Path=Command1}" CommandParameter="{Binding Path=Text, ElementName=TextBox1}" /> <Button x:Name="Button2" Command="{Binding Path=Command2}" CommandParameter="{Binding Path=Text, ElementName=TextBox1}" /> I would like to refactor this into a single button that can perform either command based on a user setting like a boolean in Settings.settings. I don't have access to refactoring the CLR object itself. Also this is a Data Template there isn't codebehind for me to work with. My take is that a converter would be the best bet, but I don't know how I would put that together. The converter would need to take in the CommandParameter, as well as the DataContext so it knows which object to execute the Commands on. Can someone lend me a hand with this? Thanks in advance.

    Read the article

  • Ubuntu Equivalent of Unix Command cp -n

    - by Ted Karmel
    A software I need to install on my Ubuntu Hardy has a MAKE file which includes the command cp -n. However, I get an error stating the -n is an invalid option. The command will work on a Mac terminal but I need it to work on Ubuntu. Does anyone know the equivalent command for Ubuntu? Thanks.

    Read the article

  • command line merge tools for windows

    - by hasen j
    Are there command line merge tools for windows? I'm thinking in terms of tools that can be used in conjunction with other tools (e.g. git, unison) to resolve conflicts. Actually, it doesn't need to strictly be command-line based, as long as it "cooperate" with other command line tools (as I mentioned, git for example), then it's fine.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >