Sponsored Content
Full Discussion: Replacing \n,\n with ,
Top Forums Shell Programming and Scripting Replacing \n,\n with , Post 302266494 by skerit on Wednesday 10th of December 2008 10:24:02 AM
Old 12-10-2008
All the 3 scripts in 1 line, how cool ...

Anyway, it almost worked, except for this line:

7
,
Jurgen,4442

Which gets transformed to

7,Jurgen
4442
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help in replacing ??

hi all i have input file like this abc.txt filename.out: <TAB>ABC<TAB>9 <TAB>AKC<TAB>1 filename1.out: <TAB>XYZ<TAB>1 <TAB>XYN<TAB>4 and i am trying to replace \n\t with \t so that output will be like this: filename.out:<TAB>ABC<TAB>9<TAB>AKC<TAB>1... (5 Replies)
Discussion started by: zedex
5 Replies

2. Shell Programming and Scripting

replacing using sed

its again sed question. i have line - sed "s/$old/$new/g" "$f" > $TFILE && mv $TFILE "$f" working well if old="myoldfile" new="mynewfile" but if i want old="/home/shailesh/1test/" new="/home/shailesh/workspace/" it gives error like sed: -e expression #1, char 9: unknown option to... (2 Replies)
Discussion started by: shailesh_arya
2 Replies

3. Shell Programming and Scripting

Replacing of word

Hi all, I wanted to replace one word with another word pl help me to solve the same. example:- I wanted to replace RXOTX with RXOTRX in a perticuler file with hole. Regards, Ramesh (2 Replies)
Discussion started by: Ramesh Vellanki
2 Replies

4. Shell Programming and Scripting

Replacing Characters

Hi All, I have a file which is delimeted with the character '. i need to replace this character with the same character and also a new line. Can anyone please help me with the tr command for this. Many thanks Karan (11 Replies)
Discussion started by: karansachdeva
11 Replies

5. Shell Programming and Scripting

Replacing Characters with |

Hi All, example data.log 526569346 66815531961 09 526569346 66815531961 09 526569346 66815531961 09 526569346 66815531961 09 526569346 66815531961 09 I want like this to 526569346|66815531961|09 526569346|66815531961|09... (4 Replies)
Discussion started by: ooilinlove
4 Replies

6. UNIX for Dummies Questions & Answers

Replacing string

Hi there, I'd like to replace STRING_ZERO in FILE_ZERO.txt with the value of VALUEi-th by using something like that: VALUE1=1000 VALUE2=2000 VALUE3=3000 for((i=1;i<=3;i++)); do sed "s/STRING_ZERO/$VALUE'$i'/" FILE_ZERO.txt >> FILE_NEW.txt; done but it doesn't work... Any help... (9 Replies)
Discussion started by: Giordano Bruno
9 Replies

7. UNIX for Dummies Questions & Answers

replacing 1 character with many : tr

Hi All, I would like to know how, iff at all we can, we may use the 'tr' command to replace a single character with multiple characters. eg: if i have a string valued "him", how can i use 'tr' to replace 'i' with "oo" to make "hoom". Just replacing a single character by many. tried:-... (16 Replies)
Discussion started by: hkansal
16 Replies

8. Shell Programming and Scripting

replacing / to -

Hi, i am running a shell script where i have assigned a variable to the value passed. so my variable is var1="investment/portfolio/run.job" now i want to assign another variable var2 as "investment-portfolio-run.out" how can i do it using awk or something else.... thanks (2 Replies)
Discussion started by: rudoraj
2 Replies

9. Shell Programming and Scripting

replacing a value in a field

Hi All, I have a file yum.conf that has a field called gpgcheck this field sometimes has a value of 0 gpgcheck=0 and at other times it has a 1. I need to check the value and if it is a 1 change it to a 0 any ideas? thanks, Gartie (1 Reply)
Discussion started by: gartie
1 Replies

10. Shell Programming and Scripting

Replacing a value in all xml's

Hi Folks, Could you please advise what will be the unix command to replace the character in all xml's under a particular directory for example let say I rite now at the following below location $ cd /opt/apr/rt/conf now under conf there are so many xml's and in those xml's i want to... (2 Replies)
Discussion started by: punpun66
2 Replies
FSTRANS(9)						   BSD Kernel Developer's Manual						FSTRANS(9)

NAME
fstrans, fstrans_setstate, fstrans_getstate, fstrans_start, fstrans_start_nowait, fstrans_done, fstrans_is_owner, fscow_establish, fscow_disestablish, fscow_run -- file system suspension helper subsystem SYNOPSIS
#include <sys/mount.h> #include <sys/fstrans.h> int fstrans_setstate(struct mount *mp, enum fstrans_state new_state); enum fstrans_state fstrans_getstate(struct mount *mp); void fstrans_start(struct mount *mp, enum fstrans_lock_type lock_type); int fstrans_start_nowait(struct mount *mp, enum fstrans_lock_type lock_type); void fstrans_done(struct mount *mp); int fstrans_is_owner(struct mount *mp); int fscow_establish(struct mount *mp, int (*func)(void *, struct buf *, bool), void *cookie); int fscow_disestablish(struct mount *mp, int (*func)(void *, struct buf *, bool), void *cookie); int fscow_run(struct buf *bp, bool data_valid); DESCRIPTION
The fstrans subsystem is a set of operations to assist file system suspension. These operations must not be used outside of file systems. File systems supporting this subsystem must set the flag IMNT_HAS_TRANS in mnt_iflag. File systems are always in one of these states: FSTRANS_NORMAL Normal operations. FSTRANS_SUSPENDING Preparing a suspension. FSTRANS_SUSPENDED Suspended. This state is represented by enum fstrans_state. All file system operations use a fstrans lock. This lock is recursive. A thread already owning a lock will always get another lock. The lock has two variants: FSTRANS_SHARED A lock that will be granted if the file system is in state FSTRANS_NORMAL. FSTRANS_LAZY A lock that will be granted if the file system is in state FSTRANS_NORMAL or FSTRANS_SUSPENDING. It needs special care because operations using this variant will not block while the file system prepares suspension. The lock variant is represented by enum fstrans_lock_type. FUNCTIONS
The following functions comprise the API provided by fstrans. fstrans_getstate(mp) Returns the current state of the file system mp. fstrans_setstate(mp, new_state) Changes the state of the file system mp to new_state. fstrans_start(mp, lock_type) Sets a lock of type lock_type on the file system mp. fstrans_start_nowait(mp, lock_type) Like fstrans_start(), but will not wait for a state change of the file system when attempting to acquire the lock. The thread may still sleep while attempting to acquire the lock. fstrans_done(mp) Releases a lock on the file system mp. fstrans_is_owner(mp) Returns true if this thread is currently suspending the file system mp. fscow_establish(mp, func, cookie) Establish a copy-on-write callback for the file system mp. The function func will be called for every buffer written through this file system. fscow_disestablish(mp, func, cookie) Disestablish a copy-on-write callback registered with fscow_establish(). fscow_run(bp, data_valid) Run all copy-on-write callbacks established for the file system this buffer belongs to. If data_valid is true the buffer data has not yet been modified. RETURN VALUES
The functions fstrans_setstate() and fstrans_start_nowait() return zero on success and an error value on failure. EXAMPLES
The following is an example of a file system suspend operation. int xxx_suspendctl(struct mount *mp, int cmd) { int error; switch (cmd) { case SUSPEND_SUSPEND: error = fstrans_setstate(mp, FSTRANS_SUSPENDING); if (error != 0) return error; /* Sync file system state to disk. */ return fstrans_setstate(mp, FSTRANS_SUSPENDED); case SUSPEND_RESUME: return fstrans_setstate(mp, FSTRANS_NORMAL); default: return EINVAL; } } This is an example of a file system operation. int xxx_create(void *v) { struct vop_create_args *ap = v; struct mount *mp = ap->a_dvp->v_mount; int error; if ((error = fstrans_start(mp, FSTRANS_SHARED)) != 0) return error; /* Actually create the node. */ fstrans_done(mp); return 0; } SEE ALSO
vfs_resume(9), vfs_suspend(9) CODE REFERENCES
The actual code implementing this subsystem can be found in the file sys/kern/vfs_trans.c. HISTORY
The fstrans subsystem appeared in NetBSD 5.0. AUTHORS
The fstrans subsystem was written by Jurgen Hannken-Illjes <hannken@NetBSD.org>. BSD
April 13, 2010 BSD
All times are GMT -4. The time now is 11:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy