07-31-2009
cut and paste using awk
Hi i need a favour
i have a file which has some trillions of records. The file is like this
11111000000000192831840914000000000000000000000000000
45789899090000000000000000011111111111111111111111111
I want to cut specific postions in each line like cut1-3 and assisgn it to a variable and redirect it to another file, then cut 4-6 assign it to variable and agn redirect, like this to the whole and i dnt want to use while loop..is there a better way to do it, may be cutting at multiple postions using awk.
Please help
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
One of the things that I have learned to take for granted in the Win32 world is the cut, copy and paste hotkeys of ^X, ^C and ^V.
I use these keys all the time under Win32 to copy and paste information from one GUI into another GUI.
My question is, does X have a similiar standard?
... (4 Replies)
Discussion started by: auswipe
4 Replies
2. Shell Programming and Scripting
Hello
I have a very large file where say each line is made up of 80 characters.
I want to cut the characters from 20-30 and 50-60 from each line and then insert a delimiter between them (# or | etc).
eg
input file
000000000131.12.20990000590425246363375670011200140406... (5 Replies)
Discussion started by: PradeepRed
5 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Let's say that I have a file called table, I know that if I need to see a the second column for exampls I use:
awk ' {print $2}' table.txt
Is there anyway to use awk to actually cut a column and put it somewhere else in the table?:confused: (8 Replies)
Discussion started by: cosmologist
8 Replies
4. UNIX for Dummies Questions & Answers
Hello,
I want to be able to cut and paste columns from two tables in one command.
Presently I do the following:
cut -f 1,3-6,9 table1.in > table1.out
cut -f 7,6,1-3 table2.in > table2.out
paste table1.out -d '\t' table2.out > MergedTable.out
Is there a better way to do this?
... (1 Reply)
Discussion started by: Gussifinknottle
1 Replies
5. Shell Programming and Scripting
hi,
I have a file with content like this for an employee:
EmployeeID
101
Day_type, day
vacation,1/2/2009
sick day, 3/2/2009
personal day, 4/5/2009
jury duty day, 5/5/2009
how do I make the result to show:
EmployeeID,Day_type,day
101,vacation,1/2/2009
101,sick day,... (6 Replies)
Discussion started by: jbchen
6 Replies
6. Shell Programming and Scripting
Hi,
Need a help with shell script. I have to search for a string in one of the file, if match found, copy the line to a new file and delete the line from the exisiting file.
eg:
83510000000000063800000.1800000.1600000.1600000.2400000.1800000.2000000.21... (6 Replies)
Discussion started by: gpaulose
6 Replies
7. Shell Programming and Scripting
I have a file and need to only select users that have a shell of “/bin/bash” in the line using awk or sed please help (4 Replies)
Discussion started by: boyboy1212
4 Replies
8. UNIX for Dummies Questions & Answers
I have a file which contains 3 fields separated by tabs example
andrew kid baker
I need to swap kid and baker using cut and paste commands how is this to be done?
Thanks (1 Reply)
Discussion started by: drew211
1 Replies
9. Shell Programming and Scripting
I have a file which contains 3 fields separated by tabs example
andrew kid baker
I need to swap kid and baker using cut and paste commands how is this to be done?
Thanks (3 Replies)
Discussion started by: drew211
3 Replies
10. Shell Programming and Scripting
Hi,
I have a file like this -->
Consider z as space
#cat filename
ABC
<!--Nzzzzz-->
<!--RESUMO-->
EFG
XYZ
<!--Nzzzzz-->
<!--RESUMO-->
I need to cut the <!--RESUMO--> part and paste it to the previous line so that the file will look like this-->
ABC
<!--Nzzzzz--><!--RESUMO-->... (4 Replies)
Discussion started by: samsonata
4 Replies
LEARN ABOUT DEBIAN
cribbage
CRIBBAGE(6) BSD Games Manual CRIBBAGE(6)
NAME
cribbage -- the card game cribbage
SYNOPSIS
cribbage [-eqr]
DESCRIPTION
cribbage plays the card game cribbage, with the program playing one hand and the user the other. The program will initially ask the user if
the rules of the game are needed - if so, it will print out the appropriate section from According to Hoyle with more(1).
cribbage options include:
-e When the player makes a mistake scoring his hand or crib, provide an explanation of the correct score. (This is especially useful
for beginning players.)
-q Print a shorter form of all messages - this is only recommended for users who have played the game without specifying this option.
-r Instead of asking the player to cut the deck, the program will randomly cut the deck.
cribbage first asks the player whether he wishes to play a short game ( ``once around'', to 61) or a long game ( ``twice around'', to 121).
A response of 's' will result in a short game, any other response will play a long game.
At the start of the first game, the program asks the player to cut the deck to determine who gets the first crib. The user should respond
with a number between 0 and 51, indicating how many cards down the deck is to be cut. The player who cuts the lower ranked card gets the
first crib. If more than one game is played, the loser of the previous game gets the first crib in the current game.
For each hand, the program first prints the player's hand, whose crib it is, and then asks the player to discard two cards into the crib.
The cards are prompted for one per line, and are typed as explained below.
After discarding, the program cuts the deck (if it is the player's crib) or asks the player to cut the deck (if it's its crib); in the latter
case, the appropriate response is a number from 0 to 39 indicating how far down the remaining 40 cards are to be cut.
After cutting the deck, play starts with the non-dealer (the person who doesn't have the crib) leading the first card. Play continues, as
per cribbage, until all cards are exhausted. The program keeps track of the scoring of all points and the total of the cards on the table.
After play, the hands are scored. The program requests the player to score his hand (and the crib, if it is his) by printing out the appro-
priate cards (and the cut card enclosed in brackets). Play continues until one player reaches the game limit (61 or 121).
A carriage return when a numeric input is expected is equivalent to typing the lowest legal value; when cutting the deck this is equivalent
to choosing the top card.
Cards are specified as rank followed by suit. The ranks may be specified as one of: 'a', '2', '3', '4', '5', '6', '7', '8', '9', 't', 'j',
'q', and 'k', or alternatively, one of: 'ace', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'jack', 'queen', and
'king'. Suits may be specified as: 's', 'h', 'd', and 'c', or alternatively as: 'spades', 'hearts', 'diamonds', and 'clubs'. A card may be
specified as: ``<rank> <suit>'', or: ``<rank> of <suit>''. If the single letter rank and suit designations are used, the space separating
the suit and rank may be left out. Also, if only one card of the desired rank is playable, typing the rank is sufficient. For example, if
your hand was ``2H, 4D, 5C, 6H, JC, and KD'' and it was desired to discard the king of diamonds, any of the following could be typed: 'k',
'king', 'kd', 'k d', 'k of d', 'king d', 'king of d', 'k diamonds', 'k of diamonds', 'king diamonds', 'king of diamonds'.
FILES
/usr/games/cribbage
/var/games/bsdgames/criblog
/usr/share/games/bsdgames/cribbage.instr
AUTHORS
Earl T. Cohen wrote the logic. Ken Arnold added the screen oriented interface.
BSD
May 31, 1993 BSD