04-25-2008
how to cut first 3 characters of each line in a file
Hi Friends
I have a file
like
sample1.txt
------------
10998909.txt
10898990.txt
1898772222.txt
8980000000000.txt
I need to take first 3 characters of each line in a file and i need to print it '
like loop
109
108
189
898
like this
Please help me in this.
Thank you guys
Krish.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Please let me know how to cut first four characters from a line in UNIX after grepping the file.. (5 Replies)
Discussion started by: kaushikraman
5 Replies
2. Shell Programming and Scripting
I know this sounds simple, but I have a logfile with
> something
> something_else
> another_entry
...
how do I cut the first 2 characters off the left side? I tried to use
cut -c 1-2 somefile > someotherfile
but that just cut gave me the 2 left characters, I want to cut those out... (2 Replies)
Discussion started by: unclecameron
2 Replies
3. Shell Programming and Scripting
i want to cut first line of a file and use it.It should remove that line from file content.Plz help me (7 Replies)
Discussion started by: arghya_owen
7 Replies
4. Shell Programming and Scripting
Hi All,
Need to convert file names to upper case using tr command in Unix.
In a folder -> /apps/dd01/misc
there are two files like:
pi-abcd567sd.pdf
pi-efgh1.pdf
The output of should be like:
pi-ABCD567SD.pdf
pi-EFGH1.pdf
I have used the command to work as below:
for f... (3 Replies)
Discussion started by: a1_win
3 Replies
5. Shell Programming and Scripting
Guys,
can you help me in doing cut first 21 and 32-35 characters from file.
I tried with cut -c to cut first 21 characters ,It is succeeded.
But i need both first 21 and 32-35. (1 Reply)
Discussion started by: mohan_xunil
1 Replies
6. AIX
hello everybody
i am looking for a shell to cut a flat file (with a long unique line) according to a certain number of characters and redirect every result to an output file.
here is an example
MyFile :
12 3 456 12 3 456 12 3 456 .....
and i took every 9-characters including BLANKS... (6 Replies)
Discussion started by: fastlane3000
6 Replies
7. Shell Programming and Scripting
Hi,
I would like to cut last 13 characters of a file name and take the rename the file name as follows:
Input:
A.DAT20110517033732
Output:
A.DAT
I have tried the following command and cut last 13 characters.
echo A.DAT20110517033732 | awk '{print substr($0, length($0)-13)}'
... (3 Replies)
Discussion started by: pyaranoid
3 Replies
8. Shell Programming and Scripting
Hi Everyone,
i have a file 1.txt
<a><a"" dd>aaaaauweopriuew</f><">!(^)!</aa></ff>
<a><a"" dd>bbbbbuweopriuew</f><">!(^*)!</aa></ff>
i know i can use
perl -p -i -e "s/>aaaaa/aa/g" 1.txt
perl -p -i -e "s/>bbbbb/bb/g" 1.txt
to acheive only keep the first two characters of the five characters,... (4 Replies)
Discussion started by: jimmy_y
4 Replies
9. Shell Programming and Scripting
Hi,
I am working on one script..I am having files in the below format
file 1 (each line is separated with : delimeter)
SPLASH:SPLASH:SVN
CIB/MCH:MCH:SVN
Now I want from file 1 that most left part of the first line will store in... (6 Replies)
Discussion started by: rohit22hamirpur
6 Replies
10. Shell Programming and Scripting
Hello all,
I have a file and would like to cut the first 100 characters of the first line. I tried it with the ‘cut’-command:
cut –c100- $file > $file.tmp
But this does not work, because it will cut the first 100 characters of each line. But I need to cut them only from the beginning of... (6 Replies)
Discussion started by: API
6 Replies
LEARN ABOUT DEBIAN
x2sys_merge
X2SYS_MERGE(1gmt) Generic Mapping Tools X2SYS_MERGE(1gmt)
NAME
x2sys_merge - Merge an updated COEs tables
SYNOPSIS
x2sys_merge -Amain_COElist.d -Mnew_COElist.d
DESCRIPTION
x2sys_merge will read two crossovers data base and output the contents of the main one updated with the COEs in the second one. The second
file should only contain updated COEs relatively to the first one. That is, it MUST NOT contain any new two tracks intersections (This
point is NOT checked in the code). This program is useful when, for any good reason like file editing NAV correction or whatever, one had
to recompute only the COEs between the edited files and the rest of the database.
-A Specify the file main_COElist.d with the main crossover error data base.
-M Specify the file new_COElist.d with the newly computed crossover error data base.
OPTIONS
No space between the option flag and the associated arguments.
EXAMPLES
To update the main COE_data.txt with the new COEs estimations saved in the smaller COE_fresh.txt, try
x2sys_merge -ACOE_data.txt -MCOE_fresh.txt > COE_updated.txt
SEE ALSO
x2sys_binlist(1), x2sys_cross(1), x2sys_datalist(1), x2sys_get(1), x2sys_init(1), x2sys_list(1), x2sys_put(1), x2sys_report(1)
GMT 4.5.7 15 Jul 2011 X2SYS_MERGE(1gmt)