03-14-2016
Select lines based on character length
Great solutions! (so simple, as usual!)
Many thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Is there any way to merge two lines based on specific occurance of a character in a file.
I am having a flat file which contains multiple records.
Each row in the file should contain specified number of delimiter.
For a particular row , if the delimiter count is not matched with... (2 Replies)
Discussion started by: mohan_tuty
2 Replies
2. Shell Programming and Scripting
All,
I can't seem to find exactly what I'm looking for, and haven't had any luck patching things together.
I need to look through a file, and if the record length is not 874, then add 'E' in position 778.
Your help is greatly appreciated. (4 Replies)
Discussion started by: CutNPaste
4 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I would like to know how can I select lines of one file based on a common ID column from another file (keeping the order of the second file).
Example of file1:
ID A B C D
1-30 1 2 3
5-60 4 5 6
1-20 7 8 9
Example of file2:
ID chr pos
1-20 1 20
1-30 1 30
5-60 5 60
Desired... (2 Replies)
Discussion started by: fadista
2 Replies
4. Shell Programming and Scripting
Hello,
I use UBUNTU 12.04.
I want to write a short program using awk to select some lines in a file based on a second file.
My first file has this format with about 400,000 lines and 47 fields:
SNP1 1 12.1
SNP2 1 13.2
SNP3 1 45.2
SNP4 1 23.4
My second file has this format:
SNP2
SNP3... (1 Reply)
Discussion started by: Homa
1 Replies
5. Shell Programming and Scripting
Hi
I need to select lines from a txt file, I have got a line starting with ZMIO:MSISDN= and after a few line I have another line starting with 'MOBILE STATION ISDN NUMBER' and another one starting with 'VLR-ADDRESS' I need to copy these three lines as three different columns in a separate... (3 Replies)
Discussion started by: Tlcm sam
3 Replies
6. Shell Programming and Scripting
Hi,
I am in need of help for the two things which is to be done.
First, I have a file that has around four columns. The first column is filled with letter "A".
There are around 400 lines in the files as shown below.
A 1 5.2 3.2
A 2 0.2 4.5
A 1 2.2 2.2
A 5 2.1 ... (2 Replies)
Discussion started by: begin_shell
2 Replies
7. Shell Programming and Scripting
Hi,
I have a pipe delimeted text file where lines have been split over 2 lines and I need to join them back together. For example the file I have is similar to the following:
aaa|bbb
|ccc
ddd|eee
fff|ggg
|hhh
I ideally need to have it looking like the following
aaa|bbb|ccc
ddd|eee... (5 Replies)
Discussion started by: fuji_s
5 Replies
8. Shell Programming and Scripting
Hi,
I need help with one problem, I came across recently.
I have one input file which I need to delimit based on character length.
$ cat Input.txt
12345sda231453
asd760kjol62569
sdasw4g76gdf57
And, There is one comma separated file which mentions "start of the field" and "length... (6 Replies)
Discussion started by: Prathmesh
6 Replies
9. Shell Programming and Scripting
Good day, I am a newbie here and thanks for accepting me
I have a task to modify input data where my input data looks like
123|34567|CHINE
1|23|INDIA
34512|21|USA
104|901|INDIASee that my input has two columns with different character length but max length is 5 and minimum length is 0 which... (1 Reply)
Discussion started by: fastlearner
1 Replies
10. Shell Programming and Scripting
Hello,
I want to get the maximum value of each record separated by empty line based on the 3rd column of each row within each record?
Input:
A1 chr5D 634 7 82 707
A2 chr5D 637 6 82 713
A3 chr5D 637 5 82 713
A4 chr5D 626 1 82 704... (4 Replies)
Discussion started by: yifangt
4 Replies
CAL(1) BSD General Commands Manual CAL(1)
NAME
cal -- displays a calendar
SYNOPSIS
cal [-3hjry] [-A after] [-B before] [-d day-of-week] [-R reform-spec] [[month] year]
DESCRIPTION
cal displays a simple calendar. If arguments are not specified, the current month is displayed. The options are as follows:
-3 Same as ``-A 1 -B 1''.
-A after
Display after months after the specified month.
-B before
Display before months before the specified month.
-d day-of-week
Specifies the day of the week on which the calendar should start. Valid values are 0 through 6, presenting Sunday through Saturday,
inclusively. The default output starts on Sundays.
-h Highlight the current day, if present in the displayed calendar. If output is to a terminal, then the appropriate terminal sequences
are used, otherwise overstriking is used. If more than one -h is used and output is to a terminal, the current date will be high-
lighted in inverse video instead of bold.
-j Display Julian dates (days one-based, numbered from January 1).
-R reform-spec
Selects an alternate Gregorian reform point from the default of September 3rd, 1752. The reform-spec can be selected by one of the
built-in names (see NOTES for a list) or by a date of the form YYYY/MM/DD. The date and month may be omitted, provided that what is
specified uniquely selects a given built-in reform point. If an exact date is specified, then that date is taken to be the first
missing date of the Gregorian Reform to be applied.
-r Display the month in which the Gregorian Reform adjustment was applied, if no other month or year information is given. If used in
conjunction with -y, then the entire year is displayed.
-y Display a calendar for the current year.
If no parameters are specified, the current month's calendar is displayed. A single parameter specifies the year and optionally the month in
ISO format: ``cal 2007-12'' Two parameters denote the month (1 - 12) and year. Note that the century must be included in the year.
A year starts on Jan 1.
NOTES
In the USA and Great Britain the Gregorian Reformation occurred in 1752. By this time, most countries had recognized the reformation
(although a few did not recognize it until the 1900's.) Eleven days following September 2, 1752 were eliminated by the reformation, so the
calendar for that month is a bit unusual.
In view of the chaotic way the Gregorian calendar was adopted throughout the world in the years between 1582 and 1928 make sure to take into
account the date of the Gregorian Reformation in your region if you are checking a calendar for a very old date.
cal has a decent built-in list of Gregorian Reform dates and the names of the countries where the reform was adopted:
Italy Oct. 5, 1582 Denmark Feb. 19, 1700
Spain Oct. 5, 1582 Great Britain Sep. 3, 1752
Portugal Oct. 5, 1582 Sweden Feb. 18, 1753
Poland Oct. 5, 1582 Finland Feb. 18, 1753
France Dec. 12, 1582 Japan Dec. 20, 1872
Luxembourg Dec. 22, 1582 China Nov. 7, 1911
Netherlands Dec. 22, 1582 Bulgaria Apr. 1, 1916
Bavaria Oct. 6, 1583 U.S.S.R. Feb. 1, 1918
Austria Jan. 7, 1584 Serbia Jan. 19, 1919
Switzerland Jan. 12, 1584 Romania Jan. 19, 1919
Hungary Oct. 22, 1587 Greece Mar. 10, 1924
Germany Feb. 19, 1700 Turkey Dec. 19, 1925
Norway Feb. 19, 1700 Egypt Sep. 18, 1928
The country known as Great Britain can also be referred to as England since that has less letters and no spaces in it. This is meant only as
a measure of expediency, not as a possible slight to anyone involved.
HISTORY
A cal command appeared in Version 6 AT&T UNIX.
BSD
December 21, 2007 BSD