01-19-2007
chechout this script
#! /usr/bin/bash
cat $1|sort -c
if [ $? -eq 1 ]; then
sort -u $1|tee $1
else
echo "Already sorted"
fi
let me know if you have any questions. $1 is your input filename
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_unshift
ARRAY_UNSHIFT(3) 1 ARRAY_UNSHIFT(3)
array_unshift - Prepend one or more elements to the beginning of an array
SYNOPSIS
int array_unshift (array &$array, mixed $value1, [mixed $...])
DESCRIPTION
array_unshift(3) prepends passed elements to the front of the $array. Note that the list of elements is prepended as a whole, so that the
prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't
be touched.
PARAMETERS
o $array
- The input array.
o $value1
- First value to prepend.
RETURN VALUES
Returns the new number of elements in the $array.
EXAMPLES
Example #1
array_unshift(3) example
<?php
$queue = array("orange", "banana");
array_unshift($queue, "apple", "raspberry");
print_r($queue);
?>
The above example will output:
Array
(
[0] => apple
[1] => raspberry
[2] => orange
[3] => banana
)
SEE ALSO
array_shift(3), array_push(3), array_pop(3).
PHP Documentation Group ARRAY_UNSHIFT(3)