Sponsored Content
Top Forums Shell Programming and Scripting How to search and replace string from nth column from a file? Post 302960098 by RudiC on Tuesday 10th of November 2015 03:37:44 PM
Old 11-10-2015
Amit, you can simplify as you did unless there are fields in quotes that have commas in them.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search and replace string only in a particular column in a delimited file

I have file with multiple columns. Column values for a record may be same. Now i have to replace a column value(this can be same for the other columns) with new value. File.txt A,B,C,D,A,B,C,D,A,B,C,D A,B,C,D,A,B,C,D,A,B,C,D A,B,C,D,A,B,C,D,A,B,C,D A,B,C,D,A,B,C,D,A,B,C,D... (1 Reply)
Discussion started by: ksailesh
1 Replies

2. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

3. Shell Programming and Scripting

Replace the nth column date as MM/DD/YYYY

Hi, I need some unix command to replace the following thing. cat test.dat 1234|test|8/19/2009|8/20/2009|test 1234|test|8/9/2009|8/21/2009|test 1234|test|8/1/2009|8/2/2009|test after processing 1234|test|08/19/2009|08/20/2009|test 1234|test|08/09/2009|08/21/2009|test... (6 Replies)
Discussion started by: anshaa
6 Replies

4. Shell Programming and Scripting

awk to search for specific line and replace nth column

I need to be able to search for a string in the first column and if that string exists than replace the nth column with "-9.99". AW12000012012 2.38 1.51 3.01 1.66 0.90 0.91 1.22 0.82 0.57 1.67 2.31 3.63 0.00 AW12000012013 1.52 0.90 1.20 1.34 1.21 0.67 ... (14 Replies)
Discussion started by: ncwxpanther
14 Replies

5. Shell Programming and Scripting

How to search and replace string in column in file with command sed?

how to search and replace string in column in file with command sed or other search "INC0000003.in" and replace column 4 = "W" $ cat file.txt INC0000001.in|20150120|Y|N|N INC0000002.in|20150120|Y|N|N INC0000003.in|20150120|Y|N|N INC0000004.in|20150120|Y|N|Noutput... (4 Replies)
Discussion started by: ppmanja3
4 Replies

6. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

7. Shell Programming and Scripting

awk search and replace nth column by using a variable.

I am passing a variable and replace nth value with the variable. I tried using many options in awk command but unable to ignore the special characters in the output and also unable to pass the actual value. Input : "1","2","3" Output : "1","1000","3" TempVal=`echo 1000` Cat... (2 Replies)
Discussion started by: onesuri
2 Replies

8. Shell Programming and Scripting

Search term in nth field and replace kth column

Hi, I have a text file which looks like this a.txt A,12,Apple,Red B,33,Banana,Yellow C,66,Sky,Blue I need to search for a particular field(s) in particular column(s) and for that matching line need to replace the nth column. Sample scenario 1: Search for 66 in second field and Sky in... (5 Replies)
Discussion started by: wahi80
5 Replies

9. Shell Programming and Scripting

Replace Value of nth Column of Each Line Using Array

Hello All, I am writing a shell script with following requirement: 1. I have one input file as below CHE01,A,MSC,INO CHE02,B,NST,INC CHE03,C,STM,INP 2. In shell script I have predefined array as below: Array1={A, B, C} Array2= {U09, C04, A054} (6 Replies)
Discussion started by: angshuman
6 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
AUDIOLINK(1)						User Contributed Perl Documentation					      AUDIOLINK(1)

NAME
audiolink - Create AudioLink config file, databases and tables SYNOPSIS
audiolink [OPTION]... DESCRIPTION
AudioLink is a set of programs which help you manage your music collection. It makes searching for music on your local storage media easier and faster. Your searches can include a variety of criteria, like male artists, female artists, band, genre, etc. It supports music files of MP3 and Ogg Vorbis formats. audiolink assists you in creating a configuration file for oft-used options passed to the AudioLink programs and creating the MySQL database and tables which the AudioLink programs, alfilldb(1) and alsearch(1) use. The options specified on the command prompt override the options specified in the config file. OPTIONS
--help Brief usage information --host=xxx Connects to the MySQL server on the target host. Default is localhost. --pass=xxx Password for the database --user=xxx Username for the database --verbose Display extra information about what's going on MORE INFORMATION
The user and password fields for the database have to be specified. There are three ways of doing this: 1. Command-line arguments By specifying them via the --user and --pass command-line arguments to the programs: "alfilldb --user=mysql_username --pass=mysql_password --prompt=basic /songs/" "alsearch --user=mysql_username --pass=mysql_password --artist=kishore --td=/songs/kishore" 2. Environment variables Setting the DBI_USER and DBI_PASS environment variables: If you are using bash, ksh, zsh or sh do this: "export DBI_USER=mysql_username" "export DBI_PASS=mysql_password" If you are using csh or tcsh, do this: "setenv DBI_USER mysql_username" "setenv DBI_USER mysql_password" Consult the man page of the respective shell interpreter that you use for help on environment variables. 3. Config file Specifying them in the config file (the most convenient). The config file is stored in each user's home directory in the ~/.audiolink/config location. CONFIGURATION FILE
The AudioLink configuration file config resides in the .audiolink/ directory in the user's home directory ($HOME/.audiolink/config). The format of the current config file is pretty easy to understand: Just put in "a = b" on separate lines for all the options you want the AudioLink scripts to use by default. Here, a is the option name, like user, password, host, etc., and b is the value you wish to associate the option with. For example, to set the username for accessing the database to 'root', you would put this in the config file: "user = root" SEE ALSO
L<alfilldb(1)>, L<alsearch(1)> The current version of this man page is available on the AudioLink website at <http://audiolink.sourceforge.net/>. BUGS
Report bugs related to the AudioLink software or the man pages to the audiolink-devel mailing list <audiolink-devel@lists.sourceforge.net>. AUTHOR
This manual page is written and maintained by Amit Shah <amitshah@gmx.net> COPYRIGHT
The AudioLink package is Copyright (C) 2003, Amit Shah <amitshah@gmx.net>. All the programs and the documentation that come as part of AudioLink are licensed by the GNU General Public License v2 (GPLv2). perl v5.14.2 2012-04-09 AUDIOLINK(1)
All times are GMT -4. The time now is 05:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy