03-24-2008
Appending line number to each line and getting total number of lines
Hello, I need help in appending the line number of each line to the file and also to get the total number of lines. Can somebody please help me.
I have a file say:
abc
def
ccc
ddd
ffff
The output should be:
Instance1=abc
Instance2=def
Instance3=ccc
Instance4=ddd
Instance5=ffff
Total number of Instances=5
Thanks,
Chiru
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I am a newb as far as shell scripting and SED goes so bear with me on this one.
I want to basically append to each line in a file a delimiter character and the line's line number e.g
Change the file from :-
aaaaaa
bbbbbb
cccccc
to:-
aaaaaa;1
bbbbbb;2
cccccc;3
I have worked... (4 Replies)
Discussion started by: pjcwhite
4 Replies
2. Shell Programming and Scripting
Hi,
I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers.
To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
Discussion started by: Ezy
2 Replies
3. Shell Programming and Scripting
Hi Everybody,
I am trying to write a script that will get some perticuler data from a file and redirect to a file.
My Question is,
I have a Very huge file,In that file I have my required data is started from 25th line and it will ends in 100th line.
I know the line numbers, I need to get all... (9 Replies)
Discussion started by: Anji
9 Replies
4. Shell Programming and Scripting
I have a set of log files that are in the following format
======= set_1 ========
counter : 315
counter2: 204597
counter3: 290582
======= set_2 ========
counter : 315
counter2: 204597
counter3: 290582
======= set_3 ========
counter : 315
counter2: 204597
counter3: 290582
Is... (6 Replies)
Discussion started by: grandguest
6 Replies
5. UNIX for Dummies Questions & Answers
Hello Everyone.
I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below:
if ; then
if ; then
tail +$1 $3 | head -n $2
else
... (5 Replies)
Discussion started by: grc
5 Replies
6. Shell Programming and Scripting
Hi all,
I have text file having a number P100. what i need is when i run a script, it should add 1 to the above number and append it to the next line of a same text file.. when i use the script next time it should check the last line and add 1 to the last number and so on..
like the text... (5 Replies)
Discussion started by: smarty86
5 Replies
7. Shell Programming and Scripting
Dear all,
I've a situation here, I have a big file which contains about 20Million line as shown as below
I want to fish out some lines according to the line position of the big file, for example here line number 3,4,7 ...
so the expected output will be like this
currently I manage to... (3 Replies)
Discussion started by: masterpiece
3 Replies
8. Shell Programming and Scripting
Hi,
Anyone help me to print the lines from the flat file between 879th line number and 1424th line number.
The 879 and 1424 should be passed as input to the shell script(It should be dynamic).
Can any one give me using sed or awk?
I tried using read, and print the lines..Its taking too... (3 Replies)
Discussion started by: senthil_is
3 Replies
9. Shell Programming and Scripting
Hello everyone,
I don't really know anything about scripting, but I have to manage to make this script, out of necessity.
#!/bin/bash
while read -r line; do #I'm reading from a big wordlist
instructions using $line
done
Is there a way to automatically write the $line number the script... (4 Replies)
Discussion started by: bobylapointe
4 Replies
10. Shell Programming and Scripting
Hi All,
I've a file like this..
Sheet1
a,1
a,2
a,3
a,4
a,5
Sheet2
a,6
a,7
a,8
a,9
a,10
Sheet3
a,11
a,12
a,13 (7 Replies)
Discussion started by: manab86
7 Replies
LEARN ABOUT REDHAT
visualofccc
DisplayOfCCC(3X11) XLIB FUNCTIONS DisplayOfCCC(3X11)
NAME
DisplayOfCCC, VisualOfCCC, ScreenNumberOfCCC, ScreenWhitePointOfCCC, ClientWhitePointOfCCC - Color Conversion Context macros
SYNTAX
DisplayOfCCC(ccc)
XcmsCCC ccc;
VisualOfCCC(ccc)
XcmsCCC ccc;
ScreenNumberOfCCC(ccc)
XcmsCCC ccc;
ScreenWhitePointOfCCC(ccc)
XcmsCCC ccc;
ClientWhitePointOfCCC(ccc)
XcmsCCC ccc;
ARGUMENTS
ccc Specifies the CCC.
DESCRIPTION
The DisplayOfCCC macro returns the display associated with the specified CCC.
The VisualOfCCC macro returns the visual associated with the specified CCC.
The ScreenNumberOfCCC macro returns the number of the screen associated with the specified CCC.
The ScreenWhitePointOfCCC macro returns the screen white point of the screen associated with the specified CCC.
The ClientWhitePointOfCC macro returns the client white point of the screen associated with the specified CCC.
SEE ALSO
XcmsCCCOfColormap(3X11), XcmsConvertColors(3X11), XcmsCreateCCC(3X11), XcmsDefaultCCC(3X11), XcmsSetWhitePoint(3X11)
Xlib - C Language X Interface
X Version 11 Release 6.6 DisplayOfCCC(3X11)