01-17-2007
grep and delete 2nd duplicated of txt... -part2
Hi,
I find out one problem is...the main point is we must delete 2nd duplicated of word in txt file. For example
apple
orange
pink
green
orange
yellow
orange
red
output should be:
apple
orange
pink
green
yellow
orange
red
#For the above, check all words in txt file and delete the 2nd duplicated of word (and MUST not use sort to do, because of the order should not be changed - only delete the duplicated). Due to the file may be over 10000 words, it is very difficult for me to check..by manually.....
any small script can help?
10 More Discussions You Might Find Interesting
1. Windows & DOS: Issues & Discussions
I use sftp batch script to copy file from a remote server to local machine. Problem is when I rerun this shell after copying txt file it do not allow me to copy txt file again.
My question is , is this confrigration problem of remote server. beace same shell work fie with the other remote... (3 Replies)
Discussion started by: Jamil Qadir
3 Replies
2. Shell Programming and Scripting
How would I write a command(s) to read from a file (list) that looks like this: 29847374384 and grep from a second file (list) that looks like this: 29847374384, jkdfkjdf,3833,ddd:confused: (1 Reply)
Discussion started by: smellylizzard
1 Replies
3. Shell Programming and Scripting
I'm a biologist trying to analyse some data and I'll appreciate some help with the following problem. I have a column of characters which I'll like to delete the duplicated characters in each line and report only the unique one.No sorting should be done. E.g.
The original data:
GTG
CTC
CTC... (5 Replies)
Discussion started by: ivpz
5 Replies
4. Shell Programming and Scripting
Hi,
I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines.
Because I don't know anything about shell script I need your help.
Does anyone have a command or a hint, where I can look for?
... (1 Reply)
Discussion started by: mkrol
1 Replies
5. Homework & Coursework Questions
Hi,
I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines.
Because I don't know anything about shell script I need your help.
Does anyone have a command or a hint, where I can look for?
... (1 Reply)
Discussion started by: mkrol
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have a small problem with my script. I have everything in order but it doesnt seem to compare anything less than 1 correctly. If the input is more than 1, then the results is correct.
If the input is 0.xxx (anything) it returns erroneous results. Pls help
input=0.12
if ; then
... (7 Replies)
Discussion started by: streddy
7 Replies
7. Shell Programming and Scripting
Hi,
I`m a total newbie, well my requirement is that i have 2 files
I want to identify which countries i do not currently have in db..
how can i use the grep or another command to find this file ..
i want to match all-countries.txt with countries-in-db.txt so the output is equal to... (11 Replies)
Discussion started by: beanbaby
11 Replies
8. Shell Programming and Scripting
Hi,
I have files with this kind of format (separator is space):
A1 B1 C1 D1 E1 F1 D1 C1 G1 H1
A2 B2 C2 D2 E2 F2 D2 C2 G2 H2
A3 B3 C3 D3 E3 F3 G3 D3 C3 H3
A4 B4 C4 D4 E4 F4 G4 D4 C4 H4
I want the output to be:
A1 B1 E1 F1 G1 H1
A2 B2 E2 F2 G2 H2
A3 B3 E3 F3 G3 H3
A4 B4 E4 F4 G4... (12 Replies)
Discussion started by: Gr4wk
12 Replies
9. UNIX for Dummies Questions & Answers
Hi, I have very old files in my server like from 2012 and i want to delete them,
Please help.
Thanks in advance.. (2 Replies)
Discussion started by: nanz143
2 Replies
10. Shell Programming and Scripting
Hi,
I have the following output from an Oracle SQL statement and I want to remove duplicated column values.
I know it is possible using Oracle analytical/statistical functions but unfortunately I don't know how to use any of those.
So now, I've gone to PLAN B using awk/sed maybe or any... (5 Replies)
Discussion started by: newbie_01
5 Replies
LEARN ABOUT PHP
array_shift
ARRAY_SHIFT(3) 1 ARRAY_SHIFT(3)
array_shift - Shift an element off the beginning of array
SYNOPSIS
mixed array_shift (array &$array)
DESCRIPTION
array_shift(3) shifts the first value of the $array off and returns it, shortening the $array by one element and moving everything down.
All numerical array keys will be modified to start counting from zero while literal keys won't be touched.
Note
This function will reset(3) the array pointer of the input array after use.
PARAMETERS
o $array
- The input array.
RETURN VALUES
Returns the shifted value, or NULL if $array is empty or is not an array.
EXAMPLES
Example #1
array_shift(3) example
<?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_shift($stack);
print_r($stack);
?>
The above example will output:
Array
(
[0] => banana
[1] => apple
[2] => raspberry
)
and orange will be assigned to $fruit.
SEE ALSO
array_unshift(3), array_push(3), array_pop(3).
PHP Documentation Group ARRAY_SHIFT(3)