Tagged Questions
Manipulation of text by programs, scripts, etc.
2
votes
1answer
46 views
XML text file with `^@` characters in it?
I have an XML file that I need to parse. When I open it in nano, nano give me the message (converted from Mac format). However between each character, there is a ^@ sequence, like so:
^@t^@h^@e^@ ...
5
votes
1answer
42 views
Inderect references aka value of a value in awk
I'm searching for a way to solve this problem in awk. Input:
X 1
Y 2
Z 3
X 4
Y 5
The output should look like this:
X 5
Y 7
Z 3
I see two problems here: the first one is the indirect reference in ...
10
votes
3answers
175 views
How can I redirect matching lines to a file, and non-matching lines to a different file?
Is there a script/program/utility already available for the following requirement in a optimised way?
someCommand |
tee >(grep "pattern" > LinesWhichMatch) |
grep -v "pattern" > ...
1
vote
2answers
66 views
Adding a line to the beginning of a file [closed]
Possible Duplicate:
Inserting text at the beginning of a file with sed via the terminal in Linux
I need to add a line to the beginning of a file. The line in question is
\def\submit{}
...
2
votes
4answers
113 views
Lines 1,2,3,4,…,n-1, n to lines n,n-1, …,4,3,2,1
I just realized that I could solve this problem by reversing line numbers from 1, 2, 3,...,n to n, n-1, ..., 3,2,1 and then use the same logic as earlier. So I want to know how can I reverse the order ...
-1
votes
3answers
88 views
Number of words from a file with the Linux shell
How do I find and many words of a file with the Linux shell?
I have
text
example
text
example
text
example
text
example
And I need
text
example1
text
Example2
text
example3
text
example4
...
3
votes
3answers
99 views
Inserting text at the beginning of a file with sed via the terminal in Linux [closed]
Possible Duplicate:
How can I prepend a tag to the beginning of several files?
How do I insert text at the beginning of a file via terminal?
2
votes
2answers
129 views
Script to prepend the files path to a file recursively
I work as a grader and files submitted to me end up in a folder named with the student's name which is itself inside a specific folder on my linux share.
Currently I go through each source file and ...
2
votes
2answers
67 views
Comparing files and their properties
I get information of a certain set of files in my mail every day, which looks like this:
58623208 Sep 14 20:08 blbn_blfbe_drv
57904920 Sep 14 19:54 blbn_cycmn
55814208 Sep 14 06:02 clsa_Upd
38912000 ...
4
votes
4answers
166 views
How to prepend a license header recursively for all .h and .cpp files in a directory
I'm trying to add a license header to all header files and source files in a project directory using a for loop. This is not working, is there any other approach using sed?
1
vote
1answer
34 views
Extract several pages from a djvu file
I have a djvu file of multiple pages. I wonder how to extract a new djvu file that consists of only a subset of multiple pages?
For example, a djvu file has 10 pages, and I would like to extract a ...
1
vote
1answer
27 views
Possible to extract title and pagenum of each page in a djvu file
This is a djvu version of the questions I asked before for pdf files.
I have tried a similar idea as fred has given to the previous question. But I am now stuck at how to get the number of pages of a ...
3
votes
2answers
51 views
wc -L reports a line-length of 8 for a tab-char. bug or feature?
-L is a useful feature of wc, or so I thought. It prints the length of the longest line. For some reason it expands a single-byte tab-char to a length of 8.
Is there some way to set this to not ...
5
votes
1answer
46 views
reformatting output with aligned columns [closed]
Possible Duplicate:
A shell tool to “tablify” input data
I have a program outputting something like this:
abc defgh ijklm
nopqr stu vw
xyza bcde fghi
which I'd like ...
1
vote
3answers
69 views
How to check if a file is tab-delimited and has 8 columns?
I have two things I need to check a text file for:
If it is tab-delimited
If it has exactly 8 columns
How can I check those things and show an error message if either is false?