Sometimes I have to run a command many times in succession, for example to see if a service has started, and it becomes tedious to move my hands away from my normal typing position to press the Up Arrow and Enter keys repeatedly. Is there a way to run the previous command without the Up Arrow and Enter keys, perhaps with an elaborate she...
hi,
i have a site with a few db queries, and lots of visitors, so i thought id cache it.
this is in php, so i use ob_start() etc to get the contents and save the file. this is fast.
it takes 0.05 secs. (tbh i don't even need to cache).
the problem is with loading the file.
if i do this:
readfile($cache_file)
it takes 0.43 secs.
...
I've got a problem with my shell script. I am basically trying to create a new log file from (2) files using unix (zcat, cat) commands
FileA = gzipped logfile (.gz)
FileB = non-gzipped log file (.log)
FileC = new file from FileA:FileB
My problem is with FileC.
For example:
FileA has timestamp data from Aug19-Sept3
FileB has timest...
Hello. I am writing a simple Unix shell in C. Here's what I have so far.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main() {
char x[256], y[256], z[256];
while (1) {
getcwd(y, sizeof(y));
printf("%s$ ", y);
fgets(x, sizeof(x), stdin);
if (x[0] == 'c' && x[1...
Hello everybody,
Does anybody know a unix command to select columns from a tab delimited-file based on their respective names (something like "cut" but that would accept column names) ? I'm not looking for any perl/awk onliner obfuscating code but more for a dedicated command.
Thanks
...
Hi I'm really new to IRIX, IRIS GL, and Motif.
I must compile more than 30 C codes written in 1997.
Because these sources require header files such as XmAll.h, Xlib.h, and so on, I thought I just needed Unix and Open Motif to compile them.
I installed FreeBSD as a guest OS on my Mac OSX, so almost all missing header files were found. (e...
I'm using this unix command(in a php file) to remove a certain string and then remove the whitespace left by that string. Unfortunately in many cases, the files get completely erased.
Is there a workaround?
<?php
$dir = "./";
$rmcode = `find $dir -name "*.php"
-type f |xargs sed -i 'somestring' 2>&1`; echo "String removed.<br />\n"...
Hi,
As described in questions, if I see a file in unix then I see special characters in it like ^M at the end of every line but if I see same file in eclipse than I do not see that special characters.
How can I remove those characters in the file, if am using eclipse for editing the file, do we have to make any specific changes in th...
I have a script which connects to database and gets all records which statisfy the query. These record results are files present on a server, so now I have a text file which has all file names in it.
I want a script which would know:
What is the size of each file in the output.txt file?
What is the total size of all the files present ...
I have a file under creation in a long process. To my understanding copying that file to another file would kill the creation process. Is there away to overcome this problem?
...
I'm an emacs user considering getting a smartphone. I notice that a lot of the phone keyboards don't have extended keyboard keys (I mean thinks like ctr and esc). What editors do you smartphone people use if you have to connect to the server by ssh and do an emergency repair? I was thinking VI would be a good choice since you mostly just...
Hi All,
i want to move logs files from one path(source path) to another path(destination path). This source path and destination path is present in one text file. as::
source_path=abc/xyz
source_path=pqr/abc
desination_path=abcd/mlk
so i read this file and stored paths in different variables.i have multiple source path so i s...
I am using Visual Studio 2010 Pro for simple C programming, I would like to know how I can provide input to the program without having to manually do so. The enviroment I am used to working is your standard commandline Unix enviroment. Once I compile a C file call "inputsInts" it becomes "a.out" and to test input I would type:
The easy ...
Hi,
I don't have much in the way of Unix/Linux experience but are wondering if it is possible in any way to run DSOs on Windows? Can these be recompiled so they will execute?
Thanks in advance for any pointers you can give me.
Dave.
...
hi,
I have been using linux for several years now, mostly ubuntu, but occasionally I encounter different unixes.
I don't really know how it works, I just know how to use it.
for example, I use package managers, I can adjust the path when I need to (i'm a coder), but usually have difficulty mounting things. except that it is somehow ve...
Hi I am trying to create a script that will count the number of characters between xml tags and idealy group by these values before returning the variations:
eg
<CONTEXT_1>aaaa<CONTEXT_1>
<CONTEXT_2>bb<CONTEXT_2>
<CONTEXT_2>dfgh<CONTEXT_2>
<CONTEXT_6>bb<CONTEXT_6>
<CONTEXT_1>bbbb<CONTEXT_1>
the result of this would be
<CONTEXT_1> 4...
% cat temp
$$$ hello1
$$ hello2
hello3
## hello4
hello5 $$$
% cat temp | grep "$$$"
Illegal variable name.
% cat temp | grep "\$\$\$"
Variable name must contain alphanumeric characters.
%
I want to grep for $$$ and I expect the result to be
% cat temp | grep <what should go here?>
$$$ hello1
hello5 $$$
%
To differentia...
a strange idea comes to me when I'm reading APUE(Advanced Programming in UNIX Environment).
It seems that in UNIX's error handling, it has 2 types of error(FATAL & INFATAL). I feel like it's something related to checked and unchecked Exceptions in JAVA.
So, to sum up, in a program, you has 2 kinds of errors, one of them is critical and...
Hi,
From a unix machine I'm trying to FTP to a server but want to log in also in the command line
e.g. ftp 10.2.3.4 username:password
Can't find the general format for doing this? ftp 10.2.3.4 -u username -p password> doesn't appear to work either?
Thanks,
...
I am one of the n users of a shared unix machine. For reasons unknown, the machine is not "responsive" enough. For example, it is slow on interactive commands, it takes few noticeable moments for any action (e.g. mouse movement, editor (e.g. gvim) keystrokes) to be visible. The problem is, the people supposedly responsible for addressing...