Questions tagged [file-manipulation]
219 questions
2
votes
1 answer
COBOL - Microfocus - Generic I/O
I am responsible for converting an old UNIX based COBOL batch application that was developed by a consultant back in the 1990s to a Windows environment but still in COBOL using Microfocus (Eclipse, etc).
This is a pretty straight-forward task…

DaveL
- 101
- 1
- 7
2
votes
3 answers
How to add she bang at the beginning of all .sh files?
I want to edit she bang line #!/bin/bash line on the top of files in all the files with .sh extension how it done by scripting.

sunil
- 751
- 1
- 8
- 9
2
votes
2 answers
How to remove contents of the file when opened using r+ mode?
I've got my file open using r+ mode. I've made some alteration to it, and I would like to remove the contents of it starting from X to the end of the file.
Unfortunately I have no clue how to do that. I've been browsing through the docs, but there's…

Krystian
- 3,193
- 2
- 33
- 71
2
votes
2 answers
read, edit & save config files (php)
I have two configuration files. One is ini one is php. They look like below. I need to update the database file name but the rest of the files must be unchanged. Any idea how to do so?
config.ini
; Turning Debugging on
[test]
developer = true
;…

Radek
- 13,813
- 52
- 161
- 255
2
votes
6 answers
How can I alter a file and write only the changes to disk - basically, sed (python)?
Let's say I have a file /etc/conf1
it's contents are along the lines of
option = banana
name = monkey
operation = eat
and let's say I want to replace "monkey" with "ostrich". How can I do that without reading the file to memory, altering it and…

Neoscopio
- 21
- 1
2
votes
1 answer
find and reverse text in multiple files with tac command in linux
I am trying to reverse the order of multiple text files (for plotting purposes) which are essentially rows of numbers. I tried to do it with tac and combined it with find and -exec as
find ./dir1/dir2/ -name foo.txt -type f -exec tac {} \;
but this…

Thangam
- 169
- 3
- 11
2
votes
1 answer
Replace specific line in text file using php while preserving to rest of the file
I have the following text file and php code, the text file holds a few minor variables and I would like to be able to update specific variables from a form.
The problem is that when the code is executed on submission it adds extra lines to the text…

Alex
- 6,610
- 3
- 20
- 38
2
votes
2 answers
Text Manipulation Split Classes in a Single File into mulitple Files
I used XSD.EXE to to generate a C# files from an XSD schema. Unfortunately, this tool extracts all the classes into a single allClasses.cs file.
Has anyone got a good technique(or tool) that will extract each of the classes in the allClasses.cs…

guazz
- 81
- 1
2
votes
1 answer
Adding text to start of each new line in a .txt file
I would like to add a predefined text to each new line on a text file and create a new text file with the added text. Please help.

user270506
- 57
- 1
- 7
2
votes
3 answers
Unique File Renaming Issue
I am developing an app right now that reads in data from a windows from and generates an XML file based on the input.
I am tasked with creating a new file each time the form is updated (User presses "Submit"). (so far so good)
Here is the catch:…

J.C.Morris
- 803
- 3
- 13
- 26
2
votes
3 answers
Output columns format sort linux
Basically after I sort I want my columns to be separated by tabs. right now it is separated by two spaces. The man pages did not have anything related to output formatting (at least I didn't notice it).
If its not possible, I guess I have to use awk…

javaCity
- 4,288
- 2
- 25
- 37
2
votes
4 answers
Trying to use Python script to add strings to file
I have a spanish novel, in a plain textfile, and I want to make a Python script that puts a translation in brackets after difficult words. I have a list of the words (with translations) I want to do this with in a separate text file, which I have…

Yngve
- 743
- 4
- 10
- 15
1
vote
4 answers
Can JQuery or JavaScript be used to manipulate XML/DOM without a browser?
I am starting to study some web technologies to integrate content, markup, layout, styling and behaviors of stuff for personal use (NOT web developing for now) and am amazed with the power of JQuery selectors and functions.
I have heard that there…

heltonbiker
- 26,657
- 28
- 137
- 252
1
vote
2 answers
Deleting few lines from a large file using a ruby script
File 1: 1356775 lines
File 2: 9516 lines
File 2 contains lines of numbers which when matched in File 1 should be deleted from that file.
Example:
File 1
34234323432 some useless stuff
23423432342 more useless stuff
98989898329 foo bar…

Omnipresent
- 29,434
- 47
- 142
- 186
1
vote
2 answers
Cannot modify file under "All Users" folder in windows 7 using C# programming
Here is my scenario,
I have an Outlook add-in which, I am writing some information into a common file through this Add-In. When I created a installable, I kept common file under "All Users"(Common Application Data Folder) folder. When I install this…

Avi Kenjale
- 2,414
- 6
- 29
- 46