Sponsored Content
Top Forums Shell Programming and Scripting Shell script to read lines in a text file and filter user data Post 302363700 by srimal on Wednesday 21st of October 2009 05:37:08 AM
Old 10-21-2009
Question Shell script to read lines in a text file and filter user data

hi all,

I have this file [myfile.txt] with some user data.

example:
Code:
$cat myfile.txt
FName|LName|Gender|Company|Branch|Bday|Salary|Age
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|
eeee|asdg|male|gggg|ksgu|19911216|||
aara|bdbm|male|kkkk|acke|19931018||23|
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|
aera|bprb|male|cccc|pppp||15000|20|
.
.
. // and so on


So what I want to do is to take out (to a file) the missing fields as following format:

Code:
<FName> <LName> <Company> Missing Field/s:<> <>

example output:

Code:
eeee asdg gggg Missing Field/s: Salary Age
aara bdbm kkkk Missing Field/s: Salary

CAN ANYONE HELP ME PLEASE?

Last edited by Franklin52; 10-21-2009 at 08:32 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script to read specific lines in a file

I have a file with contents as follows Record 1: Rejected - Error on table "DWO"."P2G_CUST_EVENTS". ORA-00001: unique constraint (DWO.CUST_EVENTS_PK) violated Record 5: Rejected - Error on table "DWO"."P2G_CUST_EVENTS". ORA-00001: unique constraint (DWO.CUST_EVENTS_PK) violated Record 6:... (5 Replies)
Discussion started by: varshanswamy
5 Replies

2. Windows & DOS: Issues & Discussions

Filter data from text file

Hi All We have got a text file, which has data dumped from 60 tables. From these 60 tables of data we need data from 4 tables only. I tried assigning line numbers to filter out data, but it is not working as intended. below is the sample file ----Table1----- 3,dfs,43,df 4,sd,5,edd... (18 Replies)
Discussion started by: b_sri
18 Replies

3. Shell Programming and Scripting

shell script to read data from text file and to load it into a table in TOAD

Hi....can you guys help me out in this script?? Below is a portion text file and it contains these: GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL005675 000001... (1 Reply)
Discussion started by: pallavishetty
1 Replies

4. Shell Programming and Scripting

How to read the data from the text file in shell script?

I am having one text file and i need to read that data from my shell script. I will expain you the scenario: Script look like: For name type 1: For age type 2: For Salary type3: echo "Enter the input:" read the data if input is 1 then go to the Text file and print the... (2 Replies)
Discussion started by: dineshmurs
2 Replies

5. Shell Programming and Scripting

Read data from .csv file through shell script & modify

I need to read data from a file called "test.csv" through shell script where the file contains values like name,price,descriptor etc. There are rows where descriptor (& in some rows name) are written as string & other characters like "car_+" OR "bike*" etc where it should contains strings like... (3 Replies)
Discussion started by: raj100
3 Replies

6. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

7. UNIX for Beginners Questions & Answers

Shell - Read a text file with two words and extract data

hi I made this simple script to extract data and pretty much is a list and would like to extract data of two words separated by commas and I would like to make a new text file that would list these extracted data into a list and each in a new line. Example that worked for me with text file... (5 Replies)
Discussion started by: dandaryll
5 Replies

8. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

9. Shell Programming and Scripting

How to get the shell script to read the .txt file as an input/data?

i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt... (11 Replies)
Discussion started by: Gurdza32
11 Replies

10. UNIX for Beginners Questions & Answers

Shell script to filter certain lines from a file

hi~ i need script on AIX. and have a text file following : create aa 1 2 3 from a@a; create bb from b; create cc 3 4 5 6 6 7 from c@c; (7 Replies)
Discussion started by: tomato00
7 Replies
pydhcp(8)							     PYDHCPLIB								 pydhcp(8)

NAME
pydhcp - a dhcp command line tool USAGE
pydhcp --input <TYPE;OPTIONS;NAME> --output <TYPE;OPTIONS;NAME> DESCRIPTION
pydhcp is a command line tool to read or write dhcp packet on network, and translate from raw data to human readable informations (and vice-et-versa). pydhcp is a part of the pydhcplib python library. Input and Output field description pydhcp takes an input and an output argument. Input and output are described in the same way. For example : pydhcp --input 'device;binary|up;eth0:68' --output 'file;readable;myfile.txt' -c 1 <TYPE> field There is 5 types for the <TYPE> field. Only one type at once can be used : device, address, file, stdin and stdout. device tells pydhcp to write or listen directly on the network interface and port. address is to write or listen on a specific Internet Address and port (like 192.168.1.1:67 ). file read or write data from or to a file. stdin read data from stdin, stdout write data on stdout. <OPTIONS> field You can use multiple options in the option field by separate them with a pipe |. There is 4 options for this field : readable, binary, up and noup. readable id to read or write data in a human readable language : a packet definition language. This language is described later. Binary form stand for reading or writing packets in the same binary form they are on the network : an UDP packet. readable and binary are mutually exclusive. Option up tells pydhcp to set the network interface up if not. noup tells not to set up the interface. up and noup are only useful in combination with the device type. Default is noup. <NAME> field Describe the name of the device (eth0:67,wlan0:client) , the address (192.168.1.1), or the filename (foo.txt). You can use a port number or the keywords client and server for standard dhcp port. Other command line options of pydhcp Option -c : Number of packet to read or write. 0 for unlimited number of packet. Default is 0. Known limitations - Only one dhcp packet per file, then count is set to 1 for file I/O - No readable transfert on network (address or device). Binary only. -c|--count Number of packets to process. EXAMPLES
Read a client packet on any address and write it on a human readable file : pydhcp -i "address;binary;0.0.0.0:67" -o "file;readable;myfile.bin" Read a binary dhcp packet from a file and print it on stdout in a human readable form : pydhcp -i "file;binary;myfile.bin" -o "stdout;readable;" SEE ALSO
pydhcplib BUGS
Many... AUTHOR
Mathieu Ignacio (mignacio[AT]april.org) pydhcp(8)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy