Skip to main content

All Questions

Tagged with
0 votes
1 answer
33 views

How to add a counter starting from a number other than 1?

I have a file where I need to add 200 more lines, but I'd like to know how to renumber them automatically. The file has the following structure: col1\tcol2\tdb4444\tcol4\tcol5\tcol6\tcol7\tcol8\tcol9\...
Primo's user avatar
  • 11
0 votes
2 answers
44 views

shell - multiple text insertion into each line of a file

I have a text containing coordinates of points such as x, y and z, I would like to change each line to be like: Point{ (1000+linenumber) } = {x , y, z}; What I want is: for example for line 212 ...
user2090491's user avatar
0 votes
1 answer
643 views

Piping a line of the file read with while read loop

I am trying to read each line of the file and then assign some parts of it to variables. A line itself is read as a variable so I need to process a variable input say for cat which seems to be ...
Jargal's user avatar
  • 1
1 vote
2 answers
790 views

Adding text to the end of multiple files, minus one line( Adding return 0; at the end of each program in C)

I have a bunch of C programs from K&R and of course, no return statement. I was wondering if there was a way to cat to the end of each file (except one line before the end, so EOF - 1) the ...
user339365's user avatar
0 votes
1 answer
732 views

How to print statistics from lines in a file

I often find myself computing percentages manually after filtering through a log file to find the proportion of X or Y in it. Can this easily be achieved via common CLI tools?
Seldaek's user avatar
  • 135
0 votes
1 answer
908 views

Combining multiple data files with header while also adding a data column

I have multiple tab delimited data files that are separated by month in the format jan06.txt, feb06.txt, ..., dec07.txt. Within each file, it looks something like: Header1 Header2 Header3 ... Data1 ...
user1027169's user avatar
31 votes
18 answers
86k views

List only the device names of all available network interfaces

I want to get a list of all available Network-Device Names on my Linux server. I figured that ifconfig would do the job, however ifconfig produces quite much output: eth0 Link encap:Ethernet ...
ftiaronsem's user avatar