I am getting a stream of numbers in a pipe, and would like to perform some operations before passing them on to the next section, but I'm a little lost about how I would go about it without breaking the pipe.
for example
> echo "1 2 3 4 5" | some command | cat
1 4 9 16 25
>
Would you have any ideas on how to make something like this...
How do I print a line which matches a particular pattern and the line before it?
I do have a dump like this:
Apple:Orange=9942501133;
Fault Code 9
Apple:Orange=9942501144;
Fault Code 9
Apple:Orange=9942501155;
Apple:Orange=9942501166;
Apple:Orange=9942501177;
Fault Code 9
Apple:Orange=9942501188;
Apple:Orange=9942501199;
Apple:Orange=9...
I have a sample file containg "aA0_- " characters on each one on a single. Sorting it using GNU sort gives the following sort order:
$ cat /tmp/sample | sort
_
-
0
a
A
after appending some other character, we obtain a different order (non-alphanumeric characters seems to have lower priority):
$ cat /tmp/sample | sed 's/$/x/' | sort
...
How do I print a line which matches a particular pattern and the line before it?
I do have a dump like this:
Apple:Orange=9942501133;
Fault Code 9
Apple:Orange=9942501144;
Fault Code 9
Apple:Orange=9942501155;
Apple:Orange=9942501166;
Apple:Orange=9942501177;
Fault Code 9
Apple:Orange=9942501188;
Apple:Orange=9942501199;
Apple:Orange=9...
I deleted symbolic link which was pointing to x binary, recreated a same link pointing to y binary i.e. now it’s pointing to y binary instead of x binary.
When I am running binary from its location it’s giving correct result. Let say the binary is at location
$/tmp/value>./y
Output is correct
If I go to another directory,
/abd/def>...
Ok, I know that System.getProperty("os.name") will give me the name of the OS I'm running under, but that's not a lot of help. What I need to know is if the OS I'm running on is a 'Unix-like' OS, I don't care if it's HP-UX, AIX, Mac OS X or whatever.
From the list of possible os.name values it seems like a quick and dirty way of detecti...
Hi,
I'm new to UNIX, having only started it at work today, but experienced with Java, and have the following code:
#/bin/bash
echo "Please enter a word:"
read word
grep -i $word $1 | cut -d',' -f1,2 | tr "," "-"> output
This works fine, but what I now need to do is to check when word is read, that it contains nothing but letters and ...
I am looking for a unix command to get a single line by passing line number to a big file (with around 5 million records). For example to get 10th line, I want to do something like
command file-name 10
Is there any such command available? We can do this by looping through each record but that will be time consuming process.
...
I am hosting a Java web service on a AIX unix box using JBoss.
Some of the web methods browse the unix file structure (IE GetDirectoryFiles returns all files for the directory path passed in).
I want to integrate this with the unix security so that the caller would pass in a username/password at the session level and they would be limi...
What I have: the login/password for a UNIX user (alice).
Who I am: some other UNIX user (bob).
What I need to do: start a process programmatically (foo) as the other user (alice).
What the end result should be: the process is running and displays alice as the owner if a "ps" is done. For purposes of privileges, acts as if alice starte...
I've a file with 2 lines having key, value pair on each line. "//" is used as comment style.
1. key = "string_key_value" //string key
How can I extract string_key_value without quotes?
2. key =100 //integer value
How can I extract 100 from here as an integer?
I've to re-use these values in another unix command.
...
Basically, I want memcached that can store over 1MB.
...
Hi i am using R on windows XP i have cygwin on my shell path
what i want to do is send a command to gawk via R shell command this way:
shell("gawk "{print $1}"", m[1],"_", h[i]."_79.7.dat""}
i get this error
Error: unexpected '{' in "shell("gawk "{"
how can i fix this problem?
Thank you
...
I remember vaguely a technique using pipes for communication between two shell processes.
Are there any tutorials available on how to setup and control a subshell?
...
I have file like this.. for eg:
number,dac,amountdac,expdate,0
1111,1,0.000000,2010-07-21,0
1111,2,0.000000,2010-07-21,0
1111,3,0.000000,2010-07-21,0
1111,4,0.000000,2010-07-21,0
1111,5,0.000000,2010-07-21,0
1111,6,0.000000,2010-07-21,0
1111,7,0.000000,2010-07-21,0
1111,8,0.000000,2010-07-21,0
1111,9,0.000000,2010-07-21,0
1111,10,0.0000...
I'm having a problem with my server at work, it's not letting me access any files via FTP that were uploaded or created by PHP, like log files and user uploads. I CAN access them via HTTP.
Server - Apache/1.3.41 (Unix)
This is a big problem for me, and I feel like it must be some server configuration because this doesn't happen elsewhe...
i am using the below code for replacing a string
inside a shell script.
echo $LINE|sed -e 's/12345678/"$replace"/g'
but its getting replaced with $replace instead of the value of that variable.
could anybody tell what went wrong.
...
i tried the awk liner below(on windows command-prompt):not working properly
gawk -v var="hot" "{ if(!NR){gsub(/cool/,var,$0) ;print} else{print}}" awk_test
input file is below
this is a cool jack
this nota cool kack
this obviously a cool jack
a unix solution is also feasible
...
Unix System programming to be precise.
...
PLEASE don't tell me why you think its a bad idea. Just tell me if its a workable idea.
I want to create files in a folder with names like the following:
[email protected]
[email protected]
[email protected]
Is there some fundamental incompatibility in the characters allowed in email addresses and those allowed by a unix syst...