Search Results

Search: Posts Made By: jimmyf
8,164
Posted By RudiC
I'm not at home on solaris; does this help: ...
I'm not at home on solaris; does this help:

sed '1 {x; d; n; }; G; s/\
/ /;' file2 file1
8,164
Posted By RudiC
That's not how it works. It prints the line incl....
That's not how it works. It prints the line incl. a <new line> char, and then reads and prints the text, regardless of the $ regex.
How about
sed '1 {x; d; n}; G; s/\n/ / ' file2 file1
This is a...
1,635
Posted By rdrtx1
awk '$4 > a[$1] {a[$1]=$4; b[$1]=$0}; END {for (i...
awk '$4 > a[$1] {a[$1]=$4; b[$1]=$0}; END {for (i in b) print b[i]}' infile
1,367
Posted By Corona688
Why are you programming shell scripts inside...
Why are you programming shell scripts inside expect?!

Use ssh as intended and you will have no need to use expect to automate the shell.
1,367
Posted By jgt
Have you tried enclosing the entire send data in...
Have you tried enclosing the entire send data in single quotes?
1,367
Posted By rbatte1
Where is /home/file.txt (do you want the local or...
Where is /home/file.txt (do you want the local or the remote) and what is in it?


Robin
724
Posted By Scrutinizer
In it it simplest form using anchors ( ^ and $ ):...
In it it simplest form using anchors ( ^ and $ ):
sed 's/^bird/bunny/; s/dog$/kitty/' file
or depending of input variation, a little better, also using spaces to mark the other side of the word...
1,459
Posted By Scrutinizer
Try: egrep -o...
Try:
egrep -o '[[:digit:]]\.[[:digit:]]|[[:digit:]][[:digit:]]\.[[:digit:]]'
To grep for literal dots.

This can be simplified to the equivalent:
grep -Eo '[[:digit:]]{1,2}\.[[:digit:]]'

But...
1,556
Posted By Yoda
sort -k2 -k4nr file
sort -k2 -k4nr file
1,556
Posted By vgersh99
I get: $ sort -k2 -k4nr myFile xxxx apples...
I get:

$ sort -k2 -k4nr myFile
xxxx apples xxxx 100
xxxx apples xxxx 90
xxxx oranges xxxx 70
xxxx oranges xxxx 80
xxxx pears xxxx 100
xxxx pears xxxx 90

is that what you're NOT after?
1,353
Posted By vbe
Ok but what follows after: #! /usr/bin/sh ...
Ok
but what follows after:
#! /usr/bin/sh
script /home/test.log
cat somefile
exit
Is not a session but a script...
script /home/test.log script get executed and is waiting for session...
1,353
Posted By drysdalk
Hi, Essentially, this is correct behaviour. ...
Hi,

Essentially, this is correct behaviour. What's happening is that the 'script' command is spawning its own sub-shell underneath your current shell, and that's why you get a shell prompt and...
841
Posted By RudiC
Sorry, yes - that was a bit short sighted; I...
Sorry, yes - that was a bit short sighted; I could not test it as I was away from my computer.
For exactly the given input, try

sed -n '/Name/{n;x;}; /Phone/{n;H;x; s/\n/ /; p}' file
John Davis...
836
Posted By Don Cragun
The literal string aaa-bbb-ccc-a file that is in...
The literal string aaa-bbb-ccc-a file that is in file2 does not appear anywhere in file1. Why do you think there should be any output???

If file2 contained:
aaa-bbb-ccc-a
instead of:...
1,104
Posted By vgersh99
a bit on a verbose side, but.. awk -f jim.awk...
a bit on a verbose side, but..
awk -f jim.awk myFile where jim.awk is:

{f4A[$4]; pA[$0]; a[$1 OFS $2 OFS $3]}
END {
for (i in a) {
printf("%s", i)
for (j in f4A)
...
1,539
Posted By RavinderSingh13
Hello jimmyf, Yes, even I am getting the...
Hello jimmyf,

Yes, even I am getting the same result as you got(tested it in BASH) bird1 first, so could you please try following and let me know if this helps you.

sort -k1,1 Input_file
...
1,539
Posted By Scrutinizer
From man/info sort: *** WARNING *** The...
From man/info sort:
*** WARNING *** The locale specified by the environment affects sort
order. Set LC_ALL=C to get the traditional sort order that uses native
byte values.
6,894
Posted By vbe
Maybe if you showed us what you tried, we could...
Maybe if you showed us what you tried, we could help you in your way, as I believe there are many solutions... and what was grep for? (here...)
1,427
Posted By Don Cragun
Saying "does not work" without showing us the...
Saying "does not work" without showing us the diagnostics you get, without telling us what operating system you're using, and without telling us what shell you're using gives us VERY little...
1,427
Posted By itkamaraj
can you explain this.. How do you add a 2nd...
can you explain this..

How do you add a 2nd option?

---------- Post updated at 10:50 AM ---------- Previous update was at 10:46 AM ----------

$ ./t.sh
Is this pre or post : pre
This is pre...
2,168
Posted By RudiC
Try awk '$1 != L {printf "%s%s", DL, $0; DL=RS; L...
Try awk '$1 != L {printf "%s%s", DL, $0; DL=RS; L = $1; next} {printf "%s%s%s%s%s", $2, OFS, $3, OFS, $4} END {print ""}' FS="," OFS="," file
2,168
Posted By Aia
awk 'F[$1]++ {$1=OFS}1' test.file
awk 'F[$1]++ {$1=OFS}1' test.file
3,570
Posted By RudiC
You need to specify the -f option to make file2...
You need to specify the -f option to make file2 the pattern file:fgrep -vf file2 file1
bird 5
fish 7
1,957
Posted By RudiC
Closing the output files would help:awk '{print >...
Closing the output files would help:awk '{print > $NF; close($NF)}' file
1,957
Posted By RudiC
Thisawk '{print > $NF}' filewould work had you...
Thisawk '{print > $NF}' filewould work had you given your sample a bit more carefully; as is, the last file name is just four.
Showing results 1 to 25 of 57

 
All times are GMT -4. The time now is 05:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy