Sponsored Content
Top Forums Shell Programming and Scripting Sort a line and Insert sorted word(s) in a line Post 302698261 by agama on Sunday 9th of September 2012 11:27:17 AM
Old 09-09-2012
I cut/pasted the code from another post I made a while back on Unix.com while en route on a plane, so I didn't test it. There's a chance that I chopped something off, but after a quick peek at it again it looks OK to me. If you could post the errors, and your code, that might help determine what isn't working.


I'm again on a plane; I'm sure someone will see it and suggest changes/corrections.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

insert word in each line of a file

can someone tell me how can I insert a word in front of each line in a file. i tried with sed but didn't managed yet. Is there another command or this one(sed) works? 10x anyway. (7 Replies)
Discussion started by: atticus
7 Replies

2. Shell Programming and Scripting

Shell script to parse a line and insert a word

Hi All, I have a file like this, data1,data2,,,data5,data6. i want to write a shell script to replace data3 with "/example/string". which means my data file should look like this . data1,data2,example/string],,data5,data6. Could you guys help me to get a sed command or any other command... (8 Replies)
Discussion started by: girish.raos
8 Replies

3. Shell Programming and Scripting

Print word 1 in line 1 and word 2 in line 2 if it matches a pattern

i have a file in this pattern MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies

4. Shell Programming and Scripting

to insert some word somewhere in the line with shell (or perl)

hello mighty all there is a line of 50 words and i need to take a random number of words from the beginning (20 words for example) then put my word then add other 10 words from the continue then add another my special word then add 20 words till the end.. my own knowledge base can say it is... (12 Replies)
Discussion started by: tip78
12 Replies

5. Shell Programming and Scripting

sort with condition and insert blank line

Hi, I have a file with no blank line anywhere Its a conf file, The lines between and starts with "#" should be sort out with the first three characters(characters are between (a-z)). and insert a blank space in between the uniq lines. For clear understanding ,pls find the below input file... (11 Replies)
Discussion started by: anil8103
11 Replies

6. UNIX for Dummies Questions & Answers

Insert a line in a sorted text file(s)

Hello, I am trying to add a line (usually just a word) to some text files in a directory that are already sorted. I just don't want to run the sort command again because it can take a long time when the text or log files are really huge. I have a bashscript that will take in the 1st argument... (7 Replies)
Discussion started by: raptor25
7 Replies

7. Shell Programming and Scripting

Read a File line by line and split into array word by word

Hi All, Hope you guys had a wonderful weekend I have a scenario where in which I have to read a file line by line and check for few words before redirecting to a file I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies

8. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

9. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

10. UNIX for Advanced & Expert Users

Sort words based on word count on each line

Hi Folks :) I have a .txt file with thousands of words. I'm trying to sort the lines in order based on number of words per line. Example from: word word word word word word word word word word word word word word word word to desired output: word (2 Replies)
Discussion started by: martinsmith
2 Replies
CSQRT(3)						   BSD Library Functions Manual 						  CSQRT(3)

NAME
csqrt -- complex square root function SYNOPSIS
#include <complex.h> double complex csqrt(double complex z); long double complex csqrtl(long double complex z); float complex csqrtf(float complex z); DESCRIPTION
csqrt(z) computes the square root of the complex floating-point number z, with a branch cut on the negative real axis. The result is in the right half-plane, including the imaginary axis. For all complex z, csqrt(conj(z)) = conj(csqrt(z)). SPECIAL VALUES
The conjugate symmetry of csqrt() is used to abbreviate the specification of special values. csqrt(+-0 + 0i) returns +0 + 0i. csqrt(x + inf i) returns inf + inf i for all x (including NaN). csqrt(x + NaN i) returns NaN + NaN i. csqrt(-inf + yi) returns 0 + inf i for any positively-signed finite y. csqrt(inf + yi) returns inf + 0i for any positively-signed finite y. csqrt(-inf + NaN i) returns NaN + inf i. csqrt(inf + NaN i) returns inf + NaN i. csqrt(NaN + yi) returns NaN + NaN i. csqrt(NaN + NaN i) returns NaN + NaN i. NOTES
If z is in the upper half-plane, then csqrt(z) is in the upper-right quadrant of the complex plane. If z is in the lower half-plane, then csqrt(z) is in the lower-right quadrant of the complex plane. SEE ALSO
complex(3) STANDARDS
The csqrt() function conforms to ISO/IEC 9899:2011. 4th Berkeley Distribution December 11, 2006 4th Berkeley Distribution
All times are GMT -4. The time now is 09:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy