Sponsored Content
Top Forums Shell Programming and Scripting Extract File line and manipulate Post 302377275 by frans on Thursday 3rd of December 2009 03:39:27 PM
Old 12-03-2009
awk
Code:
$> awk '{ print $1" "$2" "$3 }' input.txt
CODE1 XYR Test2
CODE2 XYR Test2
CODE3 XYR Test2
CODE4 XYR Test2
CODE5 XYR Test2

$> awk '{ print $1" "$3" "$4 }' input.txt
CODE1 Test2 10319389
CODE2 Test2 10319389
CODE3 Test2 10319389
CODE4 Test2 10319389
CODE5 Test2 10319389

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

To manipulate a specific line

Hi, I would like to cut a specific line from a text file and then manipulate the text in that line. For eg. below is "tmp" file. ----------------- Tue 07/05/05 00:27:34.333 Tue 07/05/05 00:27:34.333 4 events were processed for customer 315 and will be correctly resolved when 315MERGE is run:... (2 Replies)
Discussion started by: dhiman.sarkar
2 Replies

2. Shell Programming and Scripting

Extract a line from a file using the line number

I have a shell script and want to assign a value to a variable. The value is the line exctrated from a file using the line number. The line number it is not fix, and could change any time. I have tried sed, awk, head .. See my script # Get randome line number from the file #selectedline = `awk... (1 Reply)
Discussion started by: zambo
1 Replies

3. Shell Programming and Scripting

extract a line from a file using the line number

Hello, I am having trouble extracting a specific line from a file when the line number is known. My first attempt involved grep -n 'hi' (the word 'hi will always be there) to get the line number before the line that I actually want (line 4). Extra Notes: -I am working in a bash script. -The... (7 Replies)
Discussion started by: grandtheftander
7 Replies

4. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

5. Shell Programming and Scripting

extract a line from a file by line number

Hi guys, does anyone know how to extract(grep) a line from the file, if I know the line number? Thanks a lot. (9 Replies)
Discussion started by: aoussenko
9 Replies

6. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

7. Shell Programming and Scripting

Manipulate XML File Continous STRING by each Order Line using SHELL

heres sample File: <?xml version="1.0"?> <!DOCTYPE cXML SYSTEM "www"><cXML.............................................. <OrderRequest>USE UNIX.com</Extrinsic><Extrinsic name="UniqueName">Peter@UNIX.com</Extrinsic><Extrinsic name="ContractingEntity">UNIX... (3 Replies)
Discussion started by: Pete.kriya
3 Replies

8. Shell Programming and Scripting

Extract & Manipulate continous data stream-- tcpdump

Hello; I have this rather tricky problem to solve --(to me, anyways) .. I am processing the following one liner with tcpdump.. tcpdump -i T3501 -A ether host 00:1e:49:29:fc:c9 or ether host 00:1b:2b:86:ec:1b or ether host 00:21:1c:98:a4:08 and net 149.83.6.0/24 | grep --line-buffered -B... (5 Replies)
Discussion started by: delphys
5 Replies

9. Shell Programming and Scripting

Perl to extract information from a file line by line

In the below perl code I am using tags within each line to extract certain information. The tags that are used are: STB >0.8 is STRAND BIAS otherwise GOOD FDP is the second number GO towards the end of the line is read into an array and the value returned is outputed, in the first line that... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. Shell Programming and Scripting

How to manipulate string in line?

Hello, I looked up on google but do not know from which point to start... I am under ubuntu 18 bionic and Mainfile consists of 25K lines MainFile: Test,AAEE9FED3, GGBBDD DD AA X2d Moscow 112233445566aaBBccPPdddEE Test,AAEE9FED3, GG33DD s00022 Leningrad 11298932566aaBBccPPdddEE... (8 Replies)
Discussion started by: baris35
8 Replies
WVDIAL.CONF(5)							      WvDial							    WVDIAL.CONF(5)

NAME
wvdial.conf - wvdial configuration file DESCRIPTION
When wvdial starts, it first loads its configuration from /etc/wvdial.conf, which contains basic information about the modem port, speed, and init string, along with information about your Internet Service Provider (ISP), such as the phone number, your username, and your pass- word. The configuration file /etc/wvdial.conf is in Windows "ini" file format, with sections named in square brackets and a number of variable = value pairs within each section. Here is a sample configuration file: [Dialer Defaults] Modem = /dev/ttyS2 Baud = 57600 Init = ATZ Init2 = AT S11=50 Phone = 555-4242 Username = apenwarr Password = my-password [Dialer phone2] Phone = 555-4243 [Dialer shh] Init3 = ATM0 [Dialer pulse] Dial Command = ATDP The sample configuration file above contains all of the options necessary to run the two sample command lines given above. Here is a com- plete list of settings that wvdial understands: Modem The location of the device that wvdial should use as your modem. The default is /dev/modem. Baud The speed at which wvdial will communicate with your modem. The default is 57600 baud. Init1 ... Init9 wvdial can use up to nine initialization strings to set up your modem. Before dialing, these strings are sent to the modem in numerical order. These are particularly useful when specifying multiple sections. See above for an example that uses Init3 to turn the modem's speaker off. The default is "ATZ" for Init1. Phone The phone number you want wvdial to dial. You can add up to 4 other phone numbers that wvdial will dial in order, by adding: Phone1 Phone2 Phone3 Phone4 Dial Prefix wvdial will insert this string after the dial command and before the phone number. For example, to disable call waiting (in North America, anyway) set this to "*70,". Dial Command wvdial will use this string to tell the modem to dial. The default is "ATDT". Login You must set this to the username you use at your ISP. Login Prompt If your ISP has an unusual login procedure that wvdial is unable to figure out, you can use this option to specify a login prompt. When this prompt is received from your ISP, wvdial will send the Login string. Password You must set this to the password you use at your ISP. Ask Password By setting this option wvdial will prompt for your password on every dialin. Thus you don't have to save your password in /etc/wvdial.conf. (Option added by SuSE.) Password Prompt If your ISP has an unusual login procedure that wvdial is unable to figure out, you can use this option to specify a password prompt. When this prompt is received from you ISP, wvdial will send the Password string. PPPD Path If your system has pppd somewhere other than /usr/sbin/pppd, you will need to set this option. Auto DNS Try to get the Domain Nameserver (DNS) from the provider. This option is "on" by default. (Option added by SuSE.) Check DNS Check the Domain Nameserver (DNS) after the connection has been set up. This option is "on" by default. (Option added by SuSE.) DNS Test1 First DNS lookup for DNS check. (Option added by SuSE.) DNS Test2 Second DNS lookup for DNS check. (Option added by SuSE.) Check Def Route Check the default route after the connection has been set up. This option is "on" by default. (Option added by SuSE.) Force Address This option only applies if you have a static IP address at your ISP, and even then you probably don't need it. Some ISP's don't send the IP address as part of the PPP negotiation. This option forces pppd to use the address you give it. Remote Name If your ISP uses PAP or CHAP authentication, you might need to change this to your ISP's authentication name. In most cases, how- ever, it's safe to use the default value, "*". Carrier Check wvdial checks your modem during the connection process to ensure that it is actually online. If you have a weird modem that insists its carrier line is always down, you can disable the carrier check by setting this option to "no". Stupid Mode When wvdial is in Stupid Mode, it does not attempt to interpret any prompts from the terminal server. It starts pppd immediately after the modem connects. Apparently there are ISP's that actually give you a login prompt, but work only if you start PPP, rather than logging in. Go figure. Stupid Mode is (naturally) disabled by default. New PPPD You need this option if you have pppd version 2.3.0 or newer, to make wvdial create the file /etc/ppp/peers/wvdial. This option is enabled by default, thus if you have older pppd you need to set it to `no' (or upgrade pppd). Default Reply When wvdial detects a prompt, and it hasn't seen any clues that indicate what it should send as a response to the prompt, it defaults to sending "ppp". Sometimes this is inadequate. Use this option to override wvdial's default prompt response. Auto Reconnect If enabled, wvdial will attempt to automatically reestablish a connection if you are randomly disconnected by the other side. This option is "on" by default. Idle Seconds Set the hangup timeout in seconds. If there is inactivity for the given time the connection is shut down. A hangup timeout of 0 disables this feature. Abort on Busy If enabled, wvdial will not retry the connection if the modem says that the line is busy. This option is "off" by default. Abort on No Dialtone If enabled, wvdial will not retry the connection if the modem says that there is no dialtone. This option is "on" by default. Dial Attempts If value is set, wvdial will quit after that many tries .If set to 0, wvdial will happily keep dialling forever. The wvdialconf(1) program can be used to detect your modem and fill in the Modem, Baud, and Init/Init2 options automatically. SEE ALSO
wvdial(1), wvdialconf(1), pppd(8). AUTHORS
Dave Coombs and Avery Pennarun for Net Integration Technologies Inc., as part of the Worldvisions Weaver project. Greatful contributions have been made by many people, including SuSE and RedHat. Thanks Guys! Debian Project December 1999 WVDIAL.CONF(5)
All times are GMT -4. The time now is 05:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy